If you ever tried using a different O/R mapper than the ones provided by Oracle, you may have come across several issues. The most common one is a problem with the ANTLR packages. Hibernate3 uses ANTLR for the new query parser. Oracle Weblogic includes a version of ANTLR in the system classpath which will be loaded before any application libraries. If you are using Hibernate in your Webapplication you will need to package the hibernate.jar and all dependencies within you WEB-INF/lib directory. The parent ear file should have an additional weblogic-application.xml descriptor to which the configuration for the FilteringClassLoader is added.
<prefer-application-packages>
<package-name>antlr.*</package-name>
</prefer-application-packages>
If you use Hibernate as JPA provider and package your Entities in the ejb.jar files, you should only add the jars to the APP-INF/lib directory of the ear file. This works without any further problems.
Don't try changing or removing the distributed modules (BEA_HOME/modules)
com.bea.core.antlr.runtime_2.7.7.jar or
com.bea.core.antlr_2.7.7.jar
You will get in deeper trouble (e.g. admin console not completely working).
Hey, can you tell me how to configure hibernate 3.3.1 with weblogic 10.3.2 ? Thanks in advance!
ReplyDeleteHi Comeonbaby,
ReplyDeleteI expect this to be exactly the same. Have you tried it? Running into problems? Let me know.
Thanks,
Markus
Hi myfear,
ReplyDeleteI'm busy trying to do this, can you clarify for me which jars should go into the APP-INF/lib directory of the ear file?
Just the Hibernate and dependant jars, or all jars?
Cheers
ah, the APP-INF/lib thing is the JEE5 standard way of packaging ears...
ReplyDeleteHi myfear,
ReplyDeleteWe got stuck at one place during our migration from Weblogic 10.3.0 to Weblogic 10.3.2.
We have one WEB applictaion (WAR) whihc is failing during deployment on new weblogic 10.3.2. However it is working fine with WL 10.3.0.
Error during deplyment:
Failed during named quries
org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from com.creditsuisse.cashmanadvices.domain.Approver where firstName = :firstName and active=1 order by secondName ]
at org.hibernate.hql.ast.HqlLexer.panic(HqlLexer.java:80)
at antlr.CharScanner.setTokenObjectClass(CharScanner.java:340)
at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass(HqlLexer.java:54)
at antlr.CharScanner.(CharScanner.java:51)
at antlr.CharScanner.(CharScanner.java:60)
at org.hibernate.hql.antlr.HqlBaseLexer.(HqlBaseLexer.java:56)
at org.hibernate.hql.antlr.HqlBaseLexer.(HqlBaseLexer.java:53)
at org.hibernate.hql.antlr.HqlBaseLexer.(HqlBaseLexer.java:50)
at org.hibernate.hql.ast.HqlLexer.(HqlLexer.java:49)
at org.hibernate.hql.ast.HqlParser.getInstance(HqlParser.java:67)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:265)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:436)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:384)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:343)
I had referred number of threads/blogs on internet to remediate this issue; most of them say to have following entry in weblogic.xml
true
Whihc is already present in our code.
But still the same issue.
Please help at the earliest.
Thanks
Hi you need to use a FilteringClassLoader. Make sure to configure it (and use an ear!).
Delete-M