Pregunta

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.
¿Fue útil?

Solución

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.

Otros consejos

I've never faced this kind of exception but to me it sounds very clear:

The Hibernate's DialectFactory should maintain some kind mapping of data base engine type

(including version) to the actual dialect. The whole issue is that you don't have a regitered mapping to Oracle 11

As a first bet I would take a look on this particular class. I don't know what version of hibernate do you have, but it looks like Oracle 11 is simply not supported, at least by the source I've found (Take a look here) Take a look on that ''MAPPERS'' hash map and you'll see... Open source rules here ;)

So I think the best would be upgrading the hibernate to the last version (just check that in the last version the mapper is updated). Or at least debug the application server to figure out what does parameters are passed to the method and so.

Of course its also possible to build your custom version of Hibernate but I don't think it should be considered as a preferable solution.

I would also consider to override the default dialect as you've already found by yourself in 'that' article :) I don't see why it shouldn't work, but again you'd better debug it. Maybe you should tell the JBoss somewhere that it should use your dialect as well...

Hope this helps

  public String getDialectClass(int majorVersion) throws Throwable
        {
            switch(majorVersion)
            {
            case 8: // '\b'
                return (DialectFactory.class$org$hibernate$dialect$Oracle8iDialect != null ? DialectFactory.class$org$hibernate$dialect$Oracle8iDialect : (DialectFactory.class$org$hibernate$dialect$Oracle8iDialect = DialectFactory._mthclass$("org.hibernate.dialect.Oracle8iDialect"))).getName();

            case 9: // '\t'
                return (DialectFactory.class$org$hibernate$dialect$Oracle9iDialect != null ? DialectFactory.class$org$hibernate$dialect$Oracle9iDialect : (DialectFactory.class$org$hibernate$dialect$Oracle9iDialect = DialectFactory._mthclass$("org.hibernate.dialect.Oracle9iDialect"))).getName();

            case 10: // '\n'
                return (DialectFactory.class$org$hibernate$dialect$Oracle10gDialect != null ? DialectFactory.class$org$hibernate$dialect$Oracle10gDialect : (DialectFactory.class$org$hibernate$dialect$Oracle10gDialect = DialectFactory._mthclass$("org.hibernate.dialect.Oracle10gDialect"))).getName();

            case 11: // '\013'
                return (DialectFactory.class$org$hibernate$dialect$Oracle10gDialect != null ? DialectFactory.class$org$hibernate$dialect$Oracle10gDialect : (DialectFactory.class$org$hibernate$dialect$Oracle10gDialect = DialectFactory._mthclass$("org.hibernate.dialect.Oracle10gDialect"))).getName();



        }



            throw new HibernateException("unknown Oracle major version [" + majorVersion + "]");
        }

actually this is the code in DialectFactory so when your database version changes above 11 you will have this problem i have added extra switch case its resolved my problem

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top