How can I get around this invalid class loader hierarchy?

I start the iPlanet Java application server, something is loading in it commons-logging-1.0.4.jar.

This is fine until one of my applications calls AuthSSLProtocolSocketFactory, which is another apache library that also uses commons-logging.

I put jar in the jvm class path and get this error:

Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy....

It commons-loggerdoesn't seem to like having two instances loaded into different class loaders. I assume that the application server has its own class loader that loads it the first time (although I cannot find any configuration of the application server that mentions this), so when my application loads it the second time, it gives This is an exception.

I cannot change the web server, and I cannot change the apache library. Suggestions?

+3
source share
3 answers

Do you arbitrarily put public records in your classpath? You told jvm classpath, so I assume that you specify it on the command line when starting iPlanet. This is not the recommended way to load cans in J2EE applications.

The simplest thing is to simply let the Apache library use the community registration banner that comes with iPlanet. Do not put commons-logging.jar in your WEB-INF / lib directory or in any class path, and iPlanet should be automatically selected.

0
source
+3

iplanet, WebSphere PARENT_LAST. , . , .

, ( ).

0

Source: https://habr.com/ru/post/1707777/


All Articles