- This topic has 6 replies, 2 voices, and was last updated 18 years, 8 months ago by Haris Peco.
-
AuthorPosts
-
dsurberMemberI’m using Hibernate 3, Spring 1.2 to connect to MySql. I’m trying to run a simple junit test to verify my model and I’m getting the following:
org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have mor than one version of 'org.apache.commons.Log' visible, which is not allowed.
So, I checked Window>Preferences>MyEclipse>Project Capabilities and discovered that both Hibernate 3.0 and Spring 1.2 define log4j*.jar, but different versions. I removed one of them, but same error. Then I put the first one back and removed the other. Same error. Then I removed both, but now my test won’t compile because it calls BasicConfigurator.configure() and the class isn’t found.
Clearly the run path is different from the build path and log4j.jar is no longer in the build path (because I removed it from Hibernate and Spring) so things won’t compile. It is probably still in the run path so if I put it back into either Hibernate or Spring so the test will compile, there are two versions in the run path and the run fails.
I searched for log4j*.jar and found the following, all in
C:\Program Files\MyEclipse\eclipse\plugins\
com.genuitce.eclipse.springframework_4.1.1\data\1.2\lib\dependencies\log4j\log4j-1.2.9.jar com.genuitec.eclipse.sqlexplorer_4,1.1\lib\log4j.jar com.genuitec.eclipse.uml_4.1.1\lib\log4j-1.2.6.jar com.genuitec.jboss.ide.eclipse.xdoclet.core_4.0.0\log4j.jar com.genuitec.org.hibernate.eclipse_4.1.1\lib\hibernate\log4j-1.2.11.jar com.genuitec.org.hibernate.eclipse_4.1.1\myeclipse-data\2.1\lib\log4j-1.2.8.jar com.genuitec.org.hibernate.eclipse_4.1.1\myeclipse-data\3.0\lib\log4j-1.2.9.jar
So, how do I get just one version of log4j*.jar into both the build path and run path?
Douglas
– Was Eclipse freshly installed for MyEclipse? yes
– If not, was it upgraded to its current version using the update manager?
– Are any other external plugins installed? no
– How many plugins in the <eclipse>/plugins directory are like org.eclipse.pde.* doc.build_3.1.2, doc.user_3.1.2, junit.runtime_3.1.0, source_3.1.2
– What application server are you using? Tomcat 5.5*** Date: Sun Apr 30 21:43:06 PDT 2006
*** System properties:
OS=Windows2000
OS version=5.0
Java version=1.5.0_06*** MyEclipse details:
MyEclipse Enterprise WorkbenchVersion: 4.1.1 GA
Build id: 20060309-4.1.1-GA*** Eclipse details:
Eclipse SDKVersion: 3.1.2
Build id: M20060118-1600Eclipse Platform
Version: 3.1.2
Build id: M20060118-1600Eclipse RCP
Version: 3.1.2
Build id: M20060118-1600Eclipse Java Development Tools
Version: 3.1.2
Build id: M20060118-1600Eclipse Plug-in Development Environment
Version: 3.1.2
Build id: M20060118-1600Eclipse Project SDK
Version: 3.1.2
Build id: M20060118-1600Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-launcher
C:\Program Files\eclipse\eclipse.exe
-name
Eclipse
-showsplash
600
-exitdata
9f0_48
-vm
C:\WINNT\system32\javaw.exe
Haris PecoMemberdsurber,
Please, can you explain where your junit test execute – standalone JVM or tomcat JVM
and what you do at all
I suppose :
– make project
– add hibernate and spring capabilities
– make hibernate mappings and testbut please explain your steps and send your test case if it possible
org.apache.commons.Log isn’t from log4j.jar and it doesn’t exists at all.
There is org.apache.commons.logging.Log in commons-logging.jar
org.apache.commons.logging.LogConfigurationException is from commons-logging.jarHowever, your problem isn’t log4j .jar
You can have problems if you add hibernate2 and hibernate3 libraries, too
Best regards
dsurberMemberThe test is executed standalone JVM. The steps you listed are mostly correct.
– make project
– add hibernate and spring capabilities
– write java code
– annotate java code with XDoclet
– run XDoclet to generate hibernate mappings
– run test as AWT appI was unable to copy/paste the error and so I typed it by hand. You are correct about the class name, it is …commons.logging.Log. My mistake.
I’ll see if I can find a problem with commons-logging.jar. Thanks for the clue.
For what it’s worth there are 10 copies of commons-logging.jar in MyEclipse\eclipse\plugins.
Douglas
Haris PecoMemberFor what it’s worth there are 10 copies of commons-logging.jar in MyEclipse\eclipse\plugins.
it isn’t important.I make tests every day with :
make project
add hibernate and/or spring capabilities
make mapping and java with ME Reverse engine
make testsand it work fine
You needn’t find jars in ME plugins (except you make RCP app and use ME plugins 🙂 ) – you explore your project build path onlywhat mean ‘test like AWT app’ – GUI ?
Best regards
dsurberMemberI understand that only the build path is included. What I was pointing out was that many components include the same jar, sometimes with different versions. If one includes two components that each includes a different version of the same jar you can have problems. This is particularly the case of Hibernate and Spring. They each includes a different version of log4j. So if both components are in the build path, then there are two different versions of log4j.jar in the build path. The fact that there are many versions of various jars in the various components is some indication of the potential for this problem. In the case of commons-logging.jar it is not obvious what version(s) they are so it is not obvious if there is a potential problem.
AWT was a typo. Should have been SWT. Yes run the JUnit test as a GUI.
Douglas
dsurberMemberSo, it only happens if I run my test in Swing
junit.swingui.TestRunner.run(SmokeTest.class);
It doesn’t happen if I just run it.
new SmokeTest(null).run();
I’m not going to mess with it any more.
Douglas
Haris PecoMemberDouglas,
There isn’t problem with including Spring and/or Hibernate libraries.You have some mixed library in your swing test ui
Best regards
-
AuthorPosts