PDA

View Full Version : Can't use Junit in eclipse3!?


liren
Mar 14th, 2005, 04:22 AM
Hi friends:

I want to do a Junit test for my spring app in eclipse3.When I run test, it report error:

org.apache.commons.logging.LogConfigurationExcepti on: org.apache.commons.logging.LogConfigurationExcepti on: org.apache.commons.logging.LogConfigurationExcepti on: 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.LogConfigurationExcepti on: 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.LogConfigurationExcepti on: org.apache.commons.logging.LogConfigurationExcepti on: 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.LogConfigurationExcepti on: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
at org.apache.commons.logging.impl.LogFactoryImpl.new Instance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.get Instance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.get Instance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFa ctory.java:351)
at org.springframework.context.support.AbstractApplic ationContext.<init>(AbstractApplicationContext.java:115)
at org.springframework.context.support.AbstractXmlApp licationContext.<init>(AbstractXmlApplicationContext.java:47)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:80)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:68)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationContext.java:59)
at lyo.test.dao.TestSonDAOImp.setUp(TestSonDAOImp.jav a:39)
Caused by: org.apache.commons.logging.LogConfigurationExcepti on: org.apache.commons.logging.LogConfigurationExcepti on: 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.LogConfigurationExcepti on: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
at org.apache.commons.logging.impl.LogFactoryImpl.get LogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.new Instance(LogFactoryImpl.java:529)
... 17 more
Caused by: org.apache.commons.logging.LogConfigurationExcepti on: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
at org.apache.commons.logging.impl.LogFactoryImpl.get LogConstructor(LogFactoryImpl.java:385)
... 18 more


I remove common-log package from hibernate library.But the problem is the same. Did someone come across this problem? It is eclipse problem? Thks!
:(

cwilkes
Mar 17th, 2005, 01:47 AM
I remove common-log package from hibernate library.

If you want to see the gory details of what's going on see http://www.qos.ch/logging/classloader.jsp

For now I would look at this
at lyo.test.dao.TestSonDAOImp.setUp(TestSonDAOImp.jav a:39)
And see what's happening at line 39 of your code. Are you doing anything with log4j? If so try and take it out and see if that helps.

smccrory
Mar 18th, 2005, 09:11 PM
I've encountered lots of problems with JCL and Websphere, and avoid it like the plague now.