Tomcat

Oracle 8.x JDBC驅動、Hibernate和Spring有什麼組合?

  • April 12, 2016

我正在做一個必須在 Tomcat6 上執行的小項目。這是一個小型 Web 應用程序,它將使用執行 HP-UX 和 Oracle8 的舊數據庫伺服器。現在,經過幾次組合配置後,我陷入了這個異常:

GRAVE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.getJDBCMajorVersion()I
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:802)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
   at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1080)
   at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1003)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:507)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:325)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1068)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
   at org.apache.catalina.core.StandardService.start(StandardService.java:525)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.getJDBCMajorVersion()I
   at org.hibernate.engine.jdbc.JdbcSupportLoader.useContextualLobCreation(JdbcSupportLoader.java:78)
   at org.hibernate.engine.jdbc.JdbcSupportLoader.loadJdbcSupport(JdbcSupportLoader.java:52)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:121)
   at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2159)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1383)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
   at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
   ... 39 more

我對這種架構很陌生,可能需要更多地關注我需要的正確版本的框架。我正在使用:

  • 雄貓 6
  • 甲骨文 8.1.7.4
  • 數據庫:ojdbc14
  • 彈簧:2.0.5
  • 休眠:3.5.0.FINAL

將 Hibernate 框架降級到 3.2.3ga,創造了奇蹟。

謝謝大家

尋找

引用自:https://serverfault.com/questions/769429