About software development for the enterprise. Focus on Java EE and more general Java platforms.
You'll read a lot about Conferences, Java User Groups, Java EE, Integration, AS7, WildFly, EAP and other technologies that hit my road.

Friday, July 10, 2009

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

08:43 Friday, July 10, 2009 Posted by 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.


<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).