2012-08-01 18:34:09,567 ERROR [org.hibernate.util.JDBCExceptionReporter] - Cannot load JDBC driver class 'org.postgresql.Driver'
2012-08-01 18:36:47,642 ERROR [org.hibernate.util.JDBCExceptionReporter] - Cannot load JDBC driver class 'org.postgresql.Driver' 2012-08-01 18:36:47,642 ERROR [org.hibernate.util.JDBCExceptionReporter] - Cannot load JDBC driver class 'org.postgresql.Driver' 2012-8-1 18:36:47 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet jsp threw exception java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class org.postgresql.Driver) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1854) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573) at org.hibernate.loader.Loader.doQuery(Loader.java:696) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) at org.hibernate.loader.Loader.list(Loader.java:2120) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) at com.tintek.dao.impl.LoginInfoDaoImpl.findAll(LoginInfoDaoImpl.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy8.findAll(Unknown Source) at com.tintek.service.impl.LoginInfoServiceImpl.findAllInfo(LoginInfoServiceImpl.java:31) at org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:98) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Unknown Source)
环境:
jdk1.6.0_18+MyEclipse6.5+apache-tomcat-6.0.20
Struts1.3+Spring2.5+Hibernate3+Postgresql9.0
分析:
检查了一下我的MyEclipse6.5配置,发现在MyEclipse里面给Tomcat 配置的JDK是其默认的MyEclipse6.5.
解决:
在myEclipse中修改编译器版本:
Window->Preferences...->MyEclipse Enterprise Workbench->Servers->Tomcat->Tomcat 6.x->JDK
在这个界面可以看到jdk原来默认是MyEclipse6.5自带的版本。
单击右边的“Add...”按钮添加我们装在本机的jdk1.6
在上图中选择了jdk1.6安装目录下的jre6目录,然后ok就可以了。
在上面第一幅图中选择新添加的Tomcat JDK name--------------jre6
确定之后,重新编译项目,ok,问题解决。
原文链接:https://www.f2er.com/postgresql/196471.html