hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Bloch <bl...@laszlosystems.com>
Subject Re: commons-logging problem with httpclient
Date Fri, 10 Dec 2004 04:02:28 GMT
There is a sad tale about commons-logging and the disasters/wasted man 
hours it has caused.  Many decent java programmers have wasted days 
hoping to trace down issues here.  See 
http://www.qos.ch/logging/thinkAgain.jsp for details.

I had such problems that I wrote and contributed to this mailing list an 
ant build file that modified commons-httpclient 2.0.1 source such that 
it called log4j directly instead of evil commons-logging.  You can check 
the archive for postings from me as I don't know if it actually made it 
into the source tree at any time.

I'd love it if httpclient would drop commons-logging.  It's not worth it.

Good luck!

-Eric

Alex Mason wrote:

> Hi all,
> 
> The problem I'm having is that when I attempt to instantiate the 
> HttpClient I get an error "Invalid class loader hierarchy.  You have 
> more than one version of 'org.apache.commons.logging.Log' visible, which 
> is not allowed." (full trace below).  The thing is this should not be 
> possible, the only other jars I have in my application WEB-INF/lib 
> directory are either my code, log4j.jar, commons-httpclient-2.0.1.jar 
> and commons-logging.jar
> 
> Removal of the commons-logging.jar leads to a class not found exception 
> relating to the LogFactory.
> 
> As far as I can see there are no other jars present in the classpath 
> that use commons logging at all.  Log4j is the only thing I can think of 
> that could possibly be causing any problems.  I do have multiple webapps 
> that use the HttpClient however.  Yet each webapp is a seperate entity 
> with seperate classes loaded...
> 
> I've found that by moving the HttpClient instantiation into the init() 
> method of my main servlet I can avoid this problem, however this is more 
> a hack than good programming and not something I feel comfortable 
> putting into production...
> 
> Any help would be most appreciated,
> Sincerely,
> Alex
> 
> 
> <stack trace at this point is leading to the line in my class that 
> attempts to instantiate the HttpClient>
> Caused by: org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: 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.  You have more than one version of 
> 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused 
> by org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: 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.  You have more than one version of 
> 'org.apache.commons.logging.Log' visible, which is not allowed.))
> [11:18:13.728]  at 
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543) 
> 
> [11:18:13.728]  at 
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235) 
> 
> [11:18:13.728]  at 
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209) 
> 
> [11:18:13.728]  at 
> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
> [11:18:13.728]  at 
> org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:69)
> [11:18:13.728]  ... 12 more
> [11:18:13.728] Caused by: 
> org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: 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.  You have more than one version of 
> 'org.apache.commons.logging.Log' visible, which is not allowed.)
> [11:18:13.728]  at 
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)

> 
> [11:18:13.728]  at 
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) 
> 
> [11:18:13.728]  ... 16 more
> [11:18:13.728] Caused by: 
> org.apache.commons.logging.LogConfigurationException: Invalid class 
> loader hierarchy.  You have more than one version of 
> 'org.apache.commons.logging.Log' visible, which is not allowed.
> [11:18:13.728]  at 
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)

> 
> [11:18:13.728]  ... 17 more
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message