Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prefer JARs from Weblogic domain over those from weblogic system

I am using Weblogic Server 12.1.1 and copied some JARs to my domain's lib folder. One of the JARs is a org.apache.commons.io jar. Now I have the problem that Weblogic itself comes with a different version of commons-io in its system classpath and so I get NoSuchMethodErrors. Is there any way to configure Weblogic to prefer the libs from domain over those from Weblogic system?

The Filtering Classloader works only on those JARs provided with the application (WEB-INF/lib).

like image 763
schoenk Avatar asked Jan 22 '26 02:01

schoenk


2 Answers

Use one of follwing options in weblogic.xml descriptor:

  • prefer-application-packages
  • prefer-web-inf-classes

Details are described here.

like image 181
Blekit Avatar answered Jan 24 '26 14:01

Blekit


For completeness, i must say that putting commons-io into the domain/lib folder is a bad solution. The problem you describe is a good reason not to put widely used libraries into this folder. The problem might be circumvented by an even worse idea: moving that library higher up in the classloader hierarchy. If you insist on excluding commons-io from your application deliverables, you might install commons-io as an endorsed lib in the jdk. (see here) This would nail down your version of commons-io for every application including weblogic itself. Of course, this would be a problem if you need to contact weblogic support.

like image 26
ralferic Avatar answered Jan 24 '26 16:01

ralferic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!