Search code examples
springjacksonweblogic12c

WebLogic 12.2.1: Override Jackson library in common_modules with version in EAR


Given a Spring 4.3.11-RELEASE web application with Jackson 2.8.10 deployed on WebLogic 12.2.2.1, we're running into issues because the Jackson version being loaded is the old one that is in the WLS oracle_common/modules tree, which takes preference over other libraries.

We tried the following:

  1. Adding preference statement in weblogic.xml

<prefer-application-packages> <package-name>com.fasterxml.jackson.*</package-name> </prefer-application-packages>

Running with the -verbose:class flag clearly shows that the bad jars are being loaded:

[Loaded com.fasterxml.jackson.databind.type.ArrayType from file:/u01/oracle/oracle_common/modules/com.fasterxml.jackson.core.jackson-databind.jar]

  1. Putting the com.fasterxml.jackson.* jar files in the domain lib folder

Nothing worked.

Also, please note this is a shared WebLogic instance where we only have write access to the domain folder, so we can't do creative ideas like physically removing the offending legacy Jackson jars from the oracle_common folder, or messing with the patch_classpath or similar.

Any help greatly appreciated!


Solution

  • The problem was that the prefer-application-packages directive was being put in the weblogic.xml inside a WAR package inside the EAR, and the classpath was not picking that in the right order:

    foo-ear -> foo.war -> WEB-INF/weblogic.xml

    We solved it by putting the directive at the EAR level: foo-ear -> META-INF -> weblogic-application.xml

    Now it's working correctly.