[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

java.lang.ExceptionInInitializerError exception

hi experts

I am using the package httpunit (jakarta).
when I run them from the eclipse it works fine.
but I need to run them from external program (that loads automaticaly java classes and run them) it gives me this exception


java.lang.ExceptionInInitializerError
        at com.aqua.adaptor.audiocodes.AudioCodesImpl.init(AudioCodesImpl.java:32)
        at jsystem.framework.system.SystemManagerImpl.getSystemObject(SystemManagerImpl.java:90)
        at jsystem.framework.system.SystemManagerImpl.getSystemObject(SystemManagerImpl.java:44)
        at jsystem.framework.system.SystemObjectImpl.initFields(SystemObjectImpl.java:140)
        at jsystem.framework.system.SystemObjectImpl.init(SystemObjectImpl.java:261)
        at com.aqua.phone.PhoneDefaultImpl.init(PhoneDefaultImpl.java:31)
        at jsystem.framework.system.SystemManagerImpl.getSystemObject(SystemManagerImpl.java:90)
        at jsystem.framework.system.SystemObjectImpl.initFields(SystemObjectImpl.java:158)
        at jsystem.framework.system.SystemObjectImpl.init(SystemObjectImpl.java:261)
        at com.aqua.phone.PhoneManager.init(PhoneManager.java:29)
        at jsystem.framework.system.SystemManagerImpl.getSystemObject(SystemManagerImpl.java:90)
        at jsystem.framework.system.SystemManagerImpl.getSystemObject(SystemManagerImpl.java:44)
        at jsystem.framework.system.SystemManagerImpl.getSystemObject(SystemManagerImpl.java:37)
        at com.juniper.automation.JuniperBasicFixture.setUp(JuniperBasicFixture.java:51)
        at jsystem.framework.fixture.Fixture.run(Fixture.java:70)
        at jsystem.framework.fixture.FixtureManager.goTo(FixtureManager.java:200)
        at junit.framework.SystemTestCase.runBare(SystemTestCase.java:110)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.SystemTestCase.run(SystemTestCase.java:100)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at jsystem.treeui.TestRunner$1.run(TestRunner.java:195)
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.))
        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.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:65)
        ... 24 more
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.getLogConstructor(LogFactoryImpl.java:397)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
        ... 28 more
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.getLogConstructor(LogFactoryImpl.java:385)
        ... 29 more

how can I solve it ?

thanks
0
aquasw
Asked:
aquasw
3 Solutions
 
StillUnAwareCommented:
As the exception stack suggests:
"You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed."

You must check Your classpath and make sure that only one httpunit library is available. In other words: remove all other apache libraries except the ones You need and prefferable leave the newest ones.
0
 
aquaswAuthor Commented:
Hi

I looked on my class path.
there is about 100 jars.
I looked in every jar.
there is only 2 jars that has the "org.apache.commons.logging." package.
commons-logging.jar and commons-logging.api.jar.
I tryed to remove the first one, and then to remove both of them, But I have still get the same exception.
when I remove both of the jars, it cann't load the relevant class, and I get the exception :
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

do you have any suggestions ?

thanks
0
 
objectsCommented:
> I tryed to remove the first one, and then to remove both of them, But I have still get the same exception.

u should be removing the 2nd one
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Yes, you should have the updated one in the class-path (or at least earlier in the class-path).
0
 
aquaswAuthor Commented:
Hi , thanks for your help

I have solve this problem, the problem was in the program that loads the classes and runs them and not in this specific application.

thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now