• Post Reply Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError - from command line  RSS feed

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i opted to continue this thread here, because now its a pure classpath problem, i guess
as i said in that post, i can compile and run tests from eclipse; but, to have junit4 run test class TodosOsTestes from command line, i get, twice: java.lang.NoClassDefFoundError...

my command line:
>>>java -cp C:\javaGranel\projNotas\lib\junit-4.1.jar;C:\javagranel\projnot
as\classes; org.junit.runner.JUnitCore testes.TodosOsTestes
my jars are in (relative to prompt)lib folder

here's the full stacktrace:
C:\javaGranel\projNotas>java -cp C:\javaGranel\projNotas\lib\junit-4.1.jar;C:\javagranel\projnot
as\classes;C:\javagranel\projnotas\lib; org.junit.runner.JUnitCore testes.TodosOsTestes
JUnit version 4.1
.........E.E...........
Time: 0,625
There were 2 failures:
1) initializationError0(persistencia.TestPersistencia)
java.lang.NoClassDefFoundError: org/hibernate/Session
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at org.junit.internal.runners.TestIntrospector.getTestMethods(TestIntrospector.java:26)
at org.junit.internal.runners.TestClassMethodsRunner.<init>(TestClassMethodsRunner.java:
27)
at org.junit.internal.runners.TestClassRunner.<init>(TestClassRunner.java:20)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
at org.junit.internal.requests.ClassesRequest.getRunner(ClassesRequest.java:23)
at org.junit.runners.Suite.<init>(Suite.java:41)
at org.junit.runners.Suite.<init>(Suite.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
at org.junit.internal.requests.ClassesRequest.getRunner(ClassesRequest.java:23)
at org.junit.runners.Suite.<init>(Suite.java:41)
at org.junit.runners.Suite.<init>(Suite.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
at org.junit.internal.requests.ClassesRequest.getRunner(ClassesRequest.java:23)
at org.junit.runner.JUnitCore.run(JUnitCore.java:100)
at org.junit.runner.JUnitCore.run(JUnitCore.java:91)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:75)
at org.junit.runner.JUnitCore.main(JUnitCore.java:42)
2) cria(persistencia.TestPersistenciaMock)
java.lang.NoClassDefFoundError: com/mockobjects/dynamic/Mock
at persistencia.TestPersistenciaMock.cria(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:9
9)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.jav
a:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRu
nner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)

at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.jav
a:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.jav
a:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.jav
a:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
at org.junit.runner.JUnitCore.run(JUnitCore.java:121)
at org.junit.runner.JUnitCore.run(JUnitCore.java:100)
at org.junit.runner.JUnitCore.run(JUnitCore.java:91)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:75)
at org.junit.runner.JUnitCore.main(JUnitCore.java:42)

FAILURES!!!
Tests run: 21, Failures: 2

what am i doing wrong?

Thanks in advance
[ September 06, 2006: Message edited by: miguel lisboa ]
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.NoClassDefFoundError: org/hibernate/Session


Your classes are using hibernate APIs. So do you have hibernate jar file? If you don't have, then download it from google.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

case solved
i was beeing lazzy
just had to add aaaaaaaaaaaaaaaaall full path and name jars to classpath (around some 20)
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!