`

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

阅读更多

昨天试了一下把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>。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics