Caused by: org.hibernate.HibernateException: unknown Oracle major version [0]

來源:互聯網
上載者:User

昨天試了一下把mysql的資料來源配置mysql-ds.xml放在jboss下面跑,成功了;後來我想那oracle資料來源配置oracle-ds.xml也可以在jboss下面跑了。我就試了一下, 在啟動Eclipse時報以下錯誤:

11:04:48,078 INFO  [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 9.2.0.1.0
11:04:48,125 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=#ztf state=Create
javax.persistence.PersistenceException: [PersistenceUnit: ztf] Unable to build EntityManagerFactory
 at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
 at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
 at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:311)
Caused by: org.hibernate.HibernateException: unknown Oracle major version [0]
 at org.hibernate.dialect.DialectFactory$1.getDialectClass(DialectFactory.java:173)
 at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:88)
 at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:62)
11:04:48,265 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS

FOR DETAILS):

*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

jboss.j2ee:jar=EntityBean.jar,name=PersonServiceBean,service=EJB3
 -> <UNKNOWN jboss.j2ee:jar=EntityBean.jar,name=PersonServiceBean,service=EJB3>{Described:** UNRESOLVED Demands

'persistence.unit:unitName=#ztf' **}

*** CONTEXTS IN ERROR: Name -> Error

persistence.unit:unitName=#ztf -> org.hibernate.HibernateException: unknown Oracle major version [0]

<UNKNOWN jboss.j2ee:jar=EntityBean.jar,name=PersonServiceBean,service=EJB3> -> ** UNRESOLVED Demands

'persistence.unit:unitName=#ztf' **

11:04:48,453 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8090

出現這個問題,接著在網上google了一下,在http://forum.hibernate.org/viewtopic.php?p=2373597下找到了答案。
我出現的問題已解決,如下:
1.persistence.xml下<jta-data-source>的資料來源配置為java:/ztfDS。
2.在persistence.xml下<properties>加入SQL方言<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>

jboss下資料來源的配置,分以下幾種情況:
1.選擇的是mysql-ds.xml,此檔案相應位置設為 <jndi-name>ztfDS</jndi-name>,那麼在persistence.xml中相應設定為<jta-data-source>java:ztfDS</jta-data-source>。
2.選擇的是oracle-ds.xml,此檔案相應位置設為<jndi-name>ztfDS</jndi-name>,那麼在persistence.xml中相應設定為<jta-data-source>java:/ztfDS</jta-data-source>。

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.