users@glassfish.java.net

Classloader hierarchy problem with common logging

From: <glassfish_at_javadesktop.org>
Date: Wed, 06 May 2009 08:11:31 PDT

The sun forum sent me here. We run iplanet 7, and recently I added an application that calls AuthSSLProtocolSocketFactory which is an apache library that uses commons logging. I put the commons-logging-1.0.4.jar on the server.xml jvm classpath 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....

I hunted around the web and all the responses were things like "don't do that."

It seems that commons logger doesn't like having two instances of itself loaded in different classloaders. I assume the application server has its own classloader that's loading it the first time (Although I can't find any appserver configuration that mentions it) so when my application goes to load it a second time, I assume in an application level classloader, it throws that exception.

I tried using commons logging 1.1.1 which one web page said might fix the problem, but then I get an java.lang.IncompatibleClassChangeError
So there's still an instance of 1.0.4 coming from somewhere.

I can't change the webserver, and I can't change the apache library. Suggestions?

Help? Please? Begging?
[Message sent by forum member 'nixomose' (nixomose)]

http://forums.java.net/jive/thread.jspa?messageID=345229