You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jux <ju...@hot.ee> on 2008/01/03 13:59:13 UTC

Problem running Unitils(JUnit-4.4) tests

Hello

I use  http://www.unitils.org/cookbook.html Unitils  for my unit-testing and
I got it working in my IDE, but it fails when maven executes the test phase
(surefire plugin).

I get the following exeption:
----------------------------------------------------------------------------------------
org.apache.maven.surefire.booter.SurefireExecutionException:
org.junit.internal.runners.TestClassMethodsRunner; nested exception is
java.lang.NoClassDefFoundError:
org.junit.internal.runners.TestClassMethodsRunner
java.lang.NoClassDefFoundError:
org.junit.internal.runners.TestClassMethodsRunner
	at java.lang.ClassLoader.defineClassImpl(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:222)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:148)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:556)
	at java.net.URLClassLoader.access$400(URLClassLoader.java:119)
	at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:961)
	at java.security.AccessController.doPrivileged(AccessController.java:274)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:487)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:604)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:561)
	at
org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:103)
	at java.lang.J9VMInternals.verifyImpl(Native Method)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:521)
	at
org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33)
	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.(JUnit4TestSet.java:45)
	at
org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)
	at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
	at
org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:150)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:111)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:615)
	at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:308)
	at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:879)
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.
----------------------------------------------------------------------------------------

So it does not find the TestClassMethodsRunner class. I checked it from
JUnit-4.4.jar and it was not there. In JUnit v.4.3.1 as well in v.4.0 that
class is present but is removed from the new version.

If you check here: (SureFire JUnit4 Runner)
http://maven.apache.org/surefire/surefire-providers/surefire-junit4/dependencies.html
It is shown that it uses JUnit4.0 and that may be the reason, why it needs
that old TestClassMethodsRunner.

Can anyone help me to configure the surefire/junit/unitils in my maven
pom.xml so that it would work. So far I have just added the dependencys:
 - JUnit-4.4
 - Unitils-1.0-rc-1


Juhan.
-- 
View this message in context: http://www.nabble.com/Problem-running-Unitils%28JUnit-4.4%29-tests-tp14596562s177p14596562.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Problem running Unitils(JUnit-4.4) tests

Posted by Jux <ju...@hot.ee>.


Jux wrote:
> 
> Hello
> 
> I use  http://www.unitils.org/cookbook.html Unitils  for my unit-testing
> and I got it working in my IDE, but it fails when maven executes the test
> phase (surefire plugin).
> 
> I get the following exeption:
> ----------------------------------------------------------------------------------------
> org.apache.maven.surefire.booter.SurefireExecutionException:
> org.junit.internal.runners.TestClassMethodsRunner; nested exception is
> java.lang.NoClassDefFoundError:
> org.junit.internal.runners.TestClassMethodsRunner
> java.lang.NoClassDefFoundError:
> org.junit.internal.runners.TestClassMethodsRunner
> 	at java.lang.ClassLoader.defineClassImpl(Native Method)
> 	at java.lang.ClassLoader.defineClass(ClassLoader.java:222)
> 	at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:148)
> 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:556)
> 	at java.net.URLClassLoader.access$400(URLClassLoader.java:119)
> 	at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:961)
> 	at java.security.AccessController.doPrivileged(AccessController.java:274)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:487)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:604)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:561)
> 	at
> org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:103)
> 	at java.lang.J9VMInternals.verifyImpl(Native Method)
> 	at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
> 	at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
> 	at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:521)
> 	at
> org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33)
> 	at
> org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
> 	at org.apache.maven.surefire.junit4.JUnit4TestSet.(JUnit4TestSet.java:45)
> 	at
> org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)
> 	at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
> 	at
> org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:150)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:111)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:615)
> 	at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:308)
> 	at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:879)
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] There are test failures.
> ----------------------------------------------------------------------------------------
> 
> So it does not find the TestClassMethodsRunner class. I checked it from
> JUnit-4.4.jar and it was not there. In JUnit v.4.3.1 as well in v.4.0 that
> class is present but is removed from the new version.
> 
> If you check here: (SureFire JUnit4 Runner)
> http://maven.apache.org/surefire/surefire-providers/surefire-junit4/dependencies.html
> It is shown that it uses JUnit4.0 and that may be the reason, why it needs
> that old TestClassMethodsRunner.
> 
> Can anyone help me to configure the surefire/junit/unitils in my maven
> pom.xml so that it would work. So far I have just added the dependencys:
>  - JUnit-4.4
>  - Unitils-1.0-rc-1
> 
> 
> Juhan.
> 

OK got it working now :)

I had issues with different versions of unitils and got confused. Simply
useing unitils-1.0 fixed the problem.

Sorry, Juhan.
-- 
View this message in context: http://www.nabble.com/Problem-running-Unitils%28JUnit-4.4%29-tests-tp14596562s177p14599584.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Problem running Unitils(JUnit-4.4) tests

Posted by Wayne Fay <wa...@gmail.com>.
Based entirely on your description of the problem (I know nothing of
Unitils), it sounds like you are going to need to use JUnit pre-4.4 to
make this work (eg change your JUnit dependency to 4.3.1). If that
doesn't work, I'd ask your question on the JUnit list and see what
they recommend.

Wayne

On 1/3/08, Jux <ju...@hot.ee> wrote:
>
> So it does not find the TestClassMethodsRunner class. I checked it from
> JUnit-4.4.jar and it was not there. In JUnit v.4.3.1 as well in v.4.0 that
> class is present but is removed from the new version.
>
> If you check here: (SureFire JUnit4 Runner)
> http://maven.apache.org/surefire/surefire-providers/surefire-junit4/dependencies.html
> It is shown that it uses JUnit4.0 and that may be the reason, why it needs
> that old TestClassMethodsRunner.
>
> Can anyone help me to configure the surefire/junit/unitils in my maven
> pom.xml so that it would work. So far I have just added the dependencys:
>  - JUnit-4.4
>  - Unitils-1.0-rc-1
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org