Hello Anis,

the cobination of NoClassDefFoundError and com.sun.org.apache.xerces (the apache xerces shifted to com.sun to avoid clashes) still smells
like a class loader problem to me.

If you are using Java 5 (aka 1.5), could you try this with Java 6?

I guess a high level classloader - maybe inside the ProbeKit - touches
xerces-stuff, so the xerces jar "belongs" to this classloader.

Then delegated classloaders take over until junit tries to serialize its results using the shifted xerces as well.

The DocumentBuilderFactoryImpl resides in the high level classloader which knows nothing about the lower level stuff, like testProbe_probe$Probe_0 -> BUMM

So either the high level classloader needs to "own" the testProbe_probe$Probe_0, or the lower level one needs to use
its own jaxp implementation. In other words testProbe_probe$Probe_0
and XML-serialization need to be owned by the same classloader.

Or the two different classloaders need to share the same classpath.

Can anyone else jump in providing the workaround for xerces-classloading issues? There are some, but I cannot remember them off the top of my head.

Regards,

Heiner

P.S.: Thanks to Ceki Gülcü, who shares a lot of deep knowledge about classloader issues on http://articles.qos.ch/classloader.html . This focuses on logging, which is as vertical a service as XML serialization and shares similar problems. Especially symbols are passed along the classloader hierarchy and used at another level to load classes.


Am 25.01.2012 15:22, schrieb Anis Yousefi:
Hi Heiner,

Thanks for your reply and suggestions.

1. The test class is part of the Quickfixj package (http://www.quickfixj.org/) 
and has not been developed by me. However, from the error message I do not 
believe that they have changed the class loader, because the error is in 
java.lang package:

20-Jan-2012 2:07:25 PM quickfix.test.acceptance.ATServer run
SEVERE: error in AT server
java.lang.NoClassDefFoundError: testProbe_probe$Probe_0
        at 
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.<init>(DocumentBuilderFactoryImpl.java)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:147)
        at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:233)
        at 
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123)
        at quickfix.DataDictionary.load(DataDictionary.java:906)
        at quickfix.DataDictionary.read(DataDictionary.java:893)
        at quickfix.DataDictionary.<init>(DataDictionary.java:109)
        at 
quickfix.DefaultSessionFactory.getDataDictionary(DefaultSessionFactory.java:325)
        at 
quickfix.DefaultSessionFactory.createDataDictionary(DefaultSessionFactory.java:219)
        at 
quickfix.DefaultSessionFactory.processFixtDataDictionaries(DefaultSessionFactory.java:258)
        at quickfix.DefaultSessionFactory.create(DefaultSessionFactory.java:113)
        at 
quickfix.mina.acceptor.AbstractSocketAcceptor.createSessions(AbstractSocketAcceptor.java:242)
        at 
quickfix.mina.acceptor.AbstractSocketAcceptor.startAcceptingConnections(AbstractSocketAcceptor.java:99)
        at quickfix.SocketAcceptor.initialize(SocketAcceptor.java:66)
        at quickfix.SocketAcceptor.start(SocketAcceptor.java:59)
        at quickfix.test.acceptance.ATServer.run(ATServer.java:193)
        at java.lang.Thread.run(Thread.java:662)

2. I checked all the jar files and directories in the CLASSPATH, only one 
contains the missing file (i.e., /home/anis/qf-t/core/probe):

/home/anis/Downloads/junit-4.10.jar:/home/anis/qf-t/core/target/classes/test:/home/anis/qf-t/core/probe:/home/anis/qf-t/core/target/quickfixj-core-SNAPSHOT.jar:/home/anis/qf-t/core/target/quickfixj-msg-fix40-SNAPSHOT.jar:/home/anis/qf-t/core/target/quickfixj-msg-fix41-SNAPSHOT.jar:/home/anis/qf-t/core/target/quickfixj-msg-fix42-SNAPSHOT.jar:/home/anis/qf-t/core/target/quickfixj-msg-fix43-SNAPSHOT.jar:/home/anis/qf-t/core/target/quickfixj-msg-fix44-SNAPSHOT.jar:/home/anis/qf-t/core/target/quickfixj-msg-fix50-SNAPSHOT.jar:/home/anis/qf-t/core/target/quickfixj-msg-fixt11-SNAPSHOT.jar:/home/anis/qf-t/core/target/classes/test:/home/anis/qf-t/core/src/test/java:/home/anis/qf-t/core/src/main/lib/mina-core-1.1.7-sources.jar:/home/anis/qf-t/core/src/main/lib/mina-core-1.1.7.jar:/home/anis/qf-t/core/src/main/lib/slf4j-api-1.6.3.jar:/home/anis/qf-t/core/src/main/lib/slf4j-jdk14-1.6.3.jar:/home/anis/qf-t/core/src/main/lib/optional/jcl-over-slf4j-1.6.3.jar:/home/anis/qf-t/core/src/main
/li
  
b/optional/log4j-1.2.15.jar:/home/anis/qf-t/core/src/main/lib/optional/mina-filter-ssl-1.1.7-sources.jar:/home/anis/qf-t/core/src/main/lib/optional/mina-filter-ssl-1.1.7.jar:/home/anis/qf-t/core/src/main/lib/optional/proxool-0.9.1.jar:/home/anis/qf-t/core/src/main/lib/optional/proxool-cglib.jar:/home/anis/qf-t/core/src/main/lib/optional/sleepycat-je_2.1.30.jar:/home/anis/qf-t/core/src/main/lib/optional/slf4j-log4j12-1.6.3.jar:/home/anis/qf-t/core/src/test/lib/hamcrest-all-1.1.jar:/home/anis/qf-t/core/src/test/lib/hsqldb-1.8.0.jar:/home/anis/qf-t/core/src/test/lib/jsch-0.1.21.jar:/home/anis/qf-t/core/src/test/lib/junit-4.5-src.jar:/home/anis/qf-t/core/src/test/lib/junit-4.5.jar:/home/anis/qf-t/core/src/test/lib/mockito-all-1.4.jar:/home/anis/qf-t/core/src/test/lib/tyrex-1.0.3.jar

anis@anis-desktop:~/qf-t/core$ ls /home/anis/qf-t/core/probe
testProbe.probe        testProbe.probeinfo   testProbe_probe$Probe_0.class
testProbe_probe.class  testProbe_probe.java  testProbe.probescript


Thanks,

Anis


On 2012-01-21, at 4:00 AM, Heiner Westphal wrote:

Hi Anis,

just two thoughts:
1. Are you using some custom classloader in your test,
   or are you changing anything related to classloading?
2. Are there two versions of class testProbe_probe$Probe_0
   on the classpath?

Especially with multiple versions of the same class in different jars there are 
usually no helpful error messages to be expected.

Regards,

Heiner

Am 20.01.2012 22:24, schrieb Anis Yousefi:
Hi there,

I desperately need your help! I've been dealing with this error message
for more than a week now and nobody has been able to help me...

I am trying to probe a java application using the standalone TPTP
probekit agent with the following linux command:

java
'-agentlib:JPIBootLoader=JPIAgent:server=standalone;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=ome/anis/qf-t/core/probe/testProbe.probescript'
junit.textui.TestRunner quickfix.test.acceptance.AcceptanceTestSuite

my application is actually a junit testcase...

Running the above command, the probing starts and I am able to see the
runtime traces. However, at some point during execution I am getting the
runtime exception: java.lang.NoClassDefFoundError: testProbe_probe$Probe_0

which is my probe file that has been needed from the start to print the
traces!!???.....

Well, here are some facts:
-I am able to probe other applications, including a simple junit test:

java
'-agentlib:JPIBootLoader=JPIAgent:server=standalone;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=ome/anis/qf-t/core/probe/testProbe.probescript'
junit.textui.TestRunner quickfix.test.acceptance.AnisJUnitTestExample

-I am able to run the quickfix.test.acceptance.AcceptanceTestSuite using
junit (no probing):

java junit.textui.TestRunner quickfix.test.acceptance.AcceptanceTestSuite

-I have set the path to testProbe_probe$Probe_0 in CLASSPATH
-I have called the System.getenv("CLASSPATH") from within my testcase
and the CLASSPATH seems to be fine
-my testcase deals with threads, sockets, etc

And my system configuration is:
-os: ubuntu 10.04-64bit (on VirtualBox!)
-java version "1.6.0_24"
-junit: junit-4.10.jar
-TPTP agent controller: agntctrl.linux_em64t-TPTP-4.7.2

Any ideas??

Please, advise. I've tried many many things with no success...

Thanks,
Anis


_______________________________________________
tptp-tracing-profiling-tools-dev mailing list
tptp-tracing-profiling-tools-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/tptp-tracing-profiling-tools-dev
_______________________________________________
tptp-tracing-profiling-tools-dev mailing list
tptp-tracing-profiling-tools-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/tptp-tracing-profiling-tools-dev

Reply via email to