使用Tomcat 8服务器创建与Oracle9数据库的连接时获取AbstractMethodError

时间:2016-02-29 05:53:13

标签: java oracle tomcat

启动Tomcat 8服务器时出现以下错误。 我正在使用ojdbc14.jar,我也尝试过使用ojdbc6.jar,但它不能正常工作。这只发生在Tomcat 8中。如果我使用Tomcat 7那么它不会抛出任何异常。 JRE版本是7

  

引起:java.lang.AbstractMethodError:   oracle.jdbc.driver.T4CConnection.isValid(I)Z at   org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:917)     在   org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:282)     在   org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:356)     在   或者.gap。数据库。   org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2289)     在   org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2038)     在   org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1532)     在   org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)     在   org.hibernate.engine.jdbc.internal.JdbcServicesImpl $ ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)     在   org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117)     在   org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)     在   org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)     在   org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)     在   org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:78)     在   org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2283)     在   org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2279)     在   org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1748)     在   org.hibernate.ejb.EntityManagerFactoryImpl。(EntityManagerFactoryImpl.java:94)     在   org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920)     在   org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)     在   org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:92)     在   org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:290)     在   org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)     在   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)     在   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)     ......还有21个

1 个答案:

答案 0 :(得分:1)

在Java 7中使用ojdbc7.jar,它应该可以工作。