Results 1 to 3 of 3

Thread: Can't use Junit in eclipse3!?

  1. #1

    Default 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. #2
    Join Date
    Feb 2005
    Posts
    217

    Default 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.

  3. #3
    Join Date
    Aug 2004
    Location
    Columbus, OH, USA
    Posts
    133

    Default

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

Similar Threads

  1. ApplicationContext returns null in Junit Test Case
    By penku in forum Spring-Modules
    Replies: 2
    Last Post: Sep 17th, 2005, 01:28 PM
  2. JDO Transactions and JUnit testing
    By markds75 in forum Data
    Replies: 2
    Last Post: Sep 17th, 2005, 01:46 AM
  3. junit problem with commons dbcp
    By silly_me in forum Data
    Replies: 5
    Last Post: Sep 2nd, 2005, 12:26 PM
  4. Petclinic example and junit tests
    By spring04 in forum Architecture
    Replies: 1
    Last Post: Nov 17th, 2004, 01:06 AM
  5. Acegi and JUnit
    By smccrory in forum Security
    Replies: 2
    Last Post: Sep 14th, 2004, 08:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •