Deploying JBOSS with HibernateException oracle major 11

Attempting to deploy an application ear file with the 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"/> 

Get log information during deployment, I don’t know why the exception is indicated in the INFO logger, can I not worry about it?

 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 use JBoss-Seam-2.2.0.GA

Tried: this , this and which

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

Update: trying

  • It turned out that the application uses 2 different sessions and
    There is one more hibernate.cfg.xml for another outdated code, there is no dialect in it.
  • So, the Oracle10g dialect for cfg.xml is added, it stopped throwing the above-mentioned unknown oracle version error, but it is excluded because it could not load 10gDialect.
  • The beauty is that sessions point to the same data source.
+4
source share
3 answers

Try to add

 hibernate.dialect=org.hibernate.dialect.Oracle10gDialect 

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

It works for me with JBoss-4.2.3.GA in the bundle of Hibernate 3.2.4.sp1 and ojdbc5 11.1.0.6.0 (both in JBoss global libs).

Update

Also double-check that an older version of sleep mode is missing somewhere in the classpath.

Distribution Packages JBoss-Seam-2.2.0.GA hibernate 3.3.1.GA while Hibernate Dialog for Oracle Database 11g? assumes at least Hibernate 3.3.2+ is required for recent JDBC drivers .

JBoss-4.2.3.GA in the Hibernate 3.2.4.sp1 bundle may contain several modern employees.

+9
source

I have never encountered such an exception, but for me it sounds very clear:

Hibernate DialectFactory must support some database engine type mapping

(including version) to the actual dialect. The whole problem is that you do not have a registered mapping for Oracle 11

As a first bet, I would look at this class. I don’t know what version of sleep mode you have, but it looks like Oracle 11 is simply not supported, at least by the source I found (look here ) Look at this "MAPPERS" hash map and you will see ... Open source rules here;)

So, I think that it is best to upgrade hibernation to the latest version (just check that mapper is updated in the latest version). Or at least debug the application server to find out what parameters are passed to the method, etc.

Of course, it is also possible to create your own version of Hibernate, but I do not think that it should be considered as the preferred solution.

I would also think about overriding the default dialect that you already found in this article :) I don’t understand why this should not work, but you better debug it. Perhaps you should tell JBoss that he should also use your dialect ...

Hope this helps

0
source
  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 + "]"); } 

this is actually the code in DialectFactory, so when your version of the database changes above 11, you have this problem, I added an extra case with a switch, solved my problem

0
source

Source: https://habr.com/ru/post/1434965/


All Articles