Announcement Announcement Module
Collapse
No announcement yet.
Can't use Junit in eclipse3!? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't use Junit in eclipse3!?

    Hi friends:

    I want to do a Junit test for my spring app in eclipse3.When I run test, it report error:
    Code:
    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.))
    	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
    	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
    	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
    	at org.springframework.context.support.AbstractApplicationContext.<init>&#40;AbstractApplicationContext.java&#58;115&#41;
    	at org.springframework.context.support.AbstractXmlApplicationContext.<init>&#40;AbstractXmlApplicationContext.java&#58;47&#41;
    	at org.springframework.context.support.FileSystemXmlApplicationContext.<init>&#40;FileSystemXmlApplicationContext.java&#58;80&#41;
    	at org.springframework.context.support.FileSystemXmlApplicationContext.<init>&#40;FileSystemXmlApplicationContext.java&#58;68&#41;
    	at org.springframework.context.support.FileSystemXmlApplicationContext.<init>&#40;FileSystemXmlApplicationContext.java&#58;59&#41;
    	at lyo.test.dao.TestSonDAOImp.setUp&#40;TestSonDAOImp.java&#58;39&#41;
    Caused by&#58; org.apache.commons.logging.LogConfigurationException&#58; org.apache.commons.logging.LogConfigurationException&#58; Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. &#40;Caused by org.apache.commons.logging.LogConfigurationException&#58; Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.&#41;
    	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor&#40;LogFactoryImpl.java&#58;397&#41;
    	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance&#40;LogFactoryImpl.java&#58;529&#41;
    	... 17 more
    Caused by&#58; org.apache.commons.logging.LogConfigurationException&#58; 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.getLogConstructor&#40;LogFactoryImpl.java&#58;385&#41;
    	... 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!

  • #2
    You're loading log4j somewhere in your code

    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
    Code:
    at lyo.test.dao.TestSonDAOImp.setUp&#40;TestSonDAOImp.java&#58;39&#41;
    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.

    Comment


    • #3
      I've encountered lots of problems with JCL and Websphere, and avoid it like the plague now.

      Comment

      Working...
      X