JBOSS deployment having HibernateException on oracle major version 11

raksja picture raksja · Sep 19, 2012 · Viewed 10k times · Source

Trying to deploy application ear file with following settings in JBoss-4.2.3.GA

jboss-app.xml

<jboss-app>
    <loader-repository>
        com.xxxx.xxx:loader=<ear-name>
      <loader-repository-config>
        java2ParentDelegation=false
      </loader-repository-config>  
    </loader-repository>
</jboss-app>

persistence.xml (just a snippet)

<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/XXXXFactory"/>

Got following logger info during deployment, I am not sure why an exception is listed in an INFO logger, can I not bother about this?

16:30:07,239 INFO  [STDOUT] 16:30:07,238 INFO  [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 11.2.0.3.0
javax.ejb.EJBException: org.hibernate.HibernateException: unknown Oracle major version [11]
    at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
    at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)


Caused by: org.hibernate.HibernateException: unknown Oracle major version [11]
    at org.hibernate.dialect.DialectFactory$1.getDialectClass(DialectFactory.java:135)
    at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:65)
    at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
    at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)

Note: We are using JBoss-Seam-2.2.0.GA

Tried: this, this and that

Please let me know if any additional information is required, I am trying to pull back the libs available in jboss to the ear.

Update: Tries

  1. Figured out that the application is using 2 different sessions and
    there is one hibernate.cfg.xml also for another legacy code, there is no dialect specified in it.
  2. So added Oracle10g dialect to cfg.xml, it stopped throwing above mentioned unknown oracle version error, but it exceptioned as it couldn't load the 10gDialect.
  3. Beauty is both the sessions are pointing to the same datasource.

Answer

Vadzim picture Vadzim · Sep 19, 2012

Try to add

hibernate.dialect=org.hibernate.dialect.Oracle10gDialect

also to JBoss/server/default/deploy/ejb3.deployer/META-INF/persistence.properties.

It works for me with JBoss-4.2.3.GA's bundled Hibernate 3.2.4.sp1 and ojdbc5 11.1.0.6.0 (both in JBoss global libs).

Update

Also recheck that an older version of hibernate is not present somewhere in classpath.

JBoss-Seam-2.2.0.GA distribution bundles hibernate 3.3.1.GA while Hibernate dialect for Oracle Database 11g? suggests that at least Hibernate 3.3.2+ is required for recent JDBC drivers.

JBoss-4.2.3.GA's bundled Hibernate 3.2.4.sp1 may have some modern staff backported.