As part of our SOA application, we have java code whose functionality relies on latest version of a third party library. Java code will fail to compile with older version of that third party library. WebLogic comes bundled with many third party libraries and in this case ,let us assume , it comes bundled with lower version of third party library used by our java code. Let us see options for overriding WebLogic jars.
During runtime, due to WebLogic’s class loading order, java code will only see lower version of required library and the code will fail.
- set PRE_CLASSPATH variable in setDomainEnv.sh file. Jars specified here will be loaded first , before the libraries used by WebLogic.
- This way our java code will see latest version of third party library.
- Even WebLogic code will use latest version of third party library. There are no issues, if that library is backward compatible. If the library is not backward compatible, server may not start or it might produce unexpected result.
- Embed third party library in our custom jar, using JarJar utility, as mentioned in JarJar solves class loading article.