Resolving conflicts with Classloaders - Example with Hibernate/Antlr
By Laurent Goldsztejn on Feb 15, 2013
The same query working properly under the old environment. At first it might look like an invalid syntax in the query but the issue is really coming from a conflict between parsers clients. The solution is to use prefer-application-packages in weblogic-application.xml (WebLogic Server-specific deployment descriptor extension for the application.xml) to define which package(s) should be loaded from the application and not from the system classloader, example:
The suitable Antlr (Java-based compiler generator client) version should be made available in the application itself, inside WEB-INF/lib - this parser being used by Hibernate. prefer-web-inf-classes must be set to true in weblogic.xml, the default value being false, for classes located in WEB-INF to be loaded in preference to the system classloader.
WLS 10.3.x is shipped with antlr version 2.7.7 (built on Mon Jun 11 12:19:48 EDT 2007 ImplVersion: 2.7.7)
WLS 12c is shipped with antlr version 126.96.36.199 (built on Fri Nov 4 19:42:39 EDT 2011 ImplVersion: 188.8.131.52)
You can find all packages versions in %Home%/modules or simply by running java weblogic.utils.Versions
For aid in configuring filtering classloaders, see Using the Classloader Analysis Tool (CAT).