Using Hibernate 3.x in Weblogic Server 10gR3 and 11g

Markus Eisele
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.


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
You will get in deeper trouble (e.g. admin console not completely working).

Post a Comment


  1. Hey, can you tell me how to configure hibernate 3.3.1 with weblogic 10.3.2 ? Thanks in advance!

  2. Hi Comeonbaby,

    I expect this to be exactly the same. Have you tried it? Running into problems? Let me know.


  3. Hi myfear,

    I'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?


  4. ah, the APP-INF/lib thing is the JEE5 standard way of packaging ears...

  5. Hi myfear,

    We 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(
    at antlr.CharScanner.setTokenObjectClass(
    at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass(
    at antlr.CharScanner.(
    at antlr.CharScanner.(
    at org.hibernate.hql.antlr.HqlBaseLexer.(
    at org.hibernate.hql.antlr.HqlBaseLexer.(
    at org.hibernate.hql.antlr.HqlBaseLexer.(
    at org.hibernate.hql.ast.HqlLexer.(
    at org.hibernate.hql.ast.HqlParser.getInstance(
    at org.hibernate.hql.ast.QueryTranslatorImpl.parse(
    at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(
    at org.hibernate.hql.ast.QueryTranslatorImpl.compile(
    at org.hibernate.engine.query.HQLQueryPlan.(
    at org.hibernate.engine.query.HQLQueryPlan.(
    at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(
    at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(
    at org.hibernate.impl.SessionFactoryImpl.(
    at org.hibernate.cfg.Configuration.buildSessionFactory(
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(
    at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(

    I had referred number of threads/blogs on internet to remediate this issue; most of them say to have following entry in weblogic.xml
    Whihc is already present in our code.
    But still the same issue.
    Please help at the earliest.

    1. Hi you need to use a FilteringClassLoader. Make sure to configure it (and use an ear!).


Post a Comment