It's all about the answers!

Ask a question

Problem with JUnit


luigi accetta (1622) | asked Jun 11 '10, 1:20 p.m.
Hi!
I'm trying to start JUnit's test but the test fails, this is the log:


java.lang.NoClassDefFoundError: org.apache.commons.httpclient.URIException
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:69)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:131)
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform.initializeDebugOptions(InternalTeamPlatform.java:228)
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform.start(InternalTeamPlatform.java:95)
at com.ibm.team.repository.client.TeamPlatform.startup(TeamPlatform.java:48)
at com.example.hellojazz.client.tests.TestHelloJazz.setUp(TestHelloJazz.java:26)
at junit.framework.TestCase.runBare(TestCase.java:128)
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.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.URIException
at java.net.URLClassLoader.findClass(URLClassLoader.java:496)
at java.lang.ClassLoader.loadClass(ClassLoader.java:631)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
... 20 more

What is the problem??
Thank a lot
Luigi

7 answers



permanent link
Nick Edgar (6.5k711) | answered Jun 13 '10, 3:11 p.m.
JAZZ DEVELOPER
Is your program (and test suite) based on the Eclipse runtime (i.e. OSGi) or standalone Java? If the former, try running with Run As > JUnit Plugin Test, which should create a launch config with your plugin and all its prerequisites. If not, use Run As > JUnit Test but you will need to add all prerequisites manually. The missing one here is org.apache.commons.httpclient.

permanent link
luigi accetta (1622) | answered Jun 14 '10, 10:56 a.m.
Is your program (and test suite) based on the Eclipse runtime (i.e. OSGi) or standalone Java? If the former, try running with Run As > JUnit Plugin Test, which should create a launch config with your plugin and all its prerequisites. If not, use Run As > JUnit Test but you will need to add all prerequisites manually. The missing one here is org.apache.commons.httpclient.

Hi,
Thanks for the answer! I have OSGi e and I'm testing JUnit with HelloJazz's plugin but i have another problem, i've added the missing org.apache.commons.httpclient to manifest's dipendences and as package to Junit'preferences but now I have a new exception:

java.lang.NoClassDefFoundError: com.ibm.team.repository.transport.auth.TransportAuthUtil
at com.ibm.team.repository.transport.client.RemoteTeamServer.setCredentials(RemoteTeamServer.java:412)
at com.ibm.team.repository.client.internal.TeamRepository.<init>(TeamRepository.java:348)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:82)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getUnmanagedRepository(TeamRepositoryService.java:119)
at com.example.hellojazz.client.tests.TestHelloJazz.login(TestHelloJazz.java:56)
at com.example.hellojazz.client.tests.TestHelloJazz.setUp(TestHelloJazz.java:28)
at junit.framework.TestCase.runBare(TestCase.java:128)
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.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassNotFoundException: com.ibm.team.repository.transport.auth.TransportAuthUtil
at java.net.URLClassLoader.findClass(URLClassLoader.java:496)
at java.lang.ClassLoader.loadClass(ClassLoader.java:631)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
... 19 more

I've added com.ibm.team.repository.transport to dipendences but the error remains.... I'm thinking that the problem is in the RCT's configuration but i don't understand what it is....Any ideas?
Luigi

permanent link
Nick Edgar (6.5k711) | answered Jun 14 '10, 11:13 a.m.
JAZZ DEVELOPER
The list of prerequisites can be quite long, and it will be tedious to go through them one by one. Are you following a particular tutorial or example? If so, at which URL? It would be simpler to fix up the doc.

permanent link
luigi accetta (1622) | answered Jun 14 '10, 1:24 p.m.
The list of prerequisites can be quite long, and it will be tedious to go through them one by one. Are you following a particular tutorial or example? If so, at which URL? It would be simpler to fix up the doc.

Yes... I'm following this guide:
http://jazz.net/library/article/118
The error is when I must create the test plug-in

permanent link
Nick Edgar (6.5k711) | answered Jun 15 '10, 9:30 a.m.
JAZZ DEVELOPER
Did you create a JUnit launch configuration or a JUnit Plug-in Test one? It sounds like you're using the former, otherwise it would complain about missing prerequisites before it actually launched, rather than failing with NoClassDefFoundError.

permanent link
michael white (1634) | answered Aug 16 '10, 10:53 p.m.
Hey,we kind of got a same problem,did you finish it yet??
could you give me your solution?
the exception always open: Platform hasn't been started yet

permanent link
Nick Edgar (6.5k711) | answered Aug 17 '10, 10:38 a.m.
JAZZ DEVELOPER
Where do you see that exception? Are you using the Ant tasks or calling the client API programmatically? Do you have the full stack trace?

The error indicates that TeamPlatform.startup() is not being called, but our Ant tasks should do that very early on in their lifecycle.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.