Override Class loader "Parent First"

WiredCoder :

I have Java web application running on a web application server single node setup, in which I am using a liberary the I included in my Web-Inf and using in my code.

The issue is that I have another application that added its liberaries to the WebSphere parent lib folder, one of which are the same liberary I am using but with an older version, creating conflict and jamming my code.

The server class loader is configured Parent first unfourtunatly and I cannot change that fact. My question is, how can I make my app use my liberary, ignoring the one used by the class loader?

Jarid :

The solution is to move the conflicting package to a shared library, configure the library to use an isolated class loader, and associate that library with your application or module. The "isolated class loader" setting creates a separate parent-last class loader for the shared library, so you get that behavior targeted to only the artifacts that need it rather than having to apply it to the entire application or module.

https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/tcws_sharedlib.html

I'm specifically referencing the "Use an isolated class loader for this shared library" setting.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=111136&siteId=1