Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » ClassNotFoundException when running JUnit test(ClassNotFoundException when running JUnit test)
ClassNotFoundException when running JUnit test [message #903319] Thu, 23 August 2012 03:18 Go to next message
Kris Ram is currently offline Kris Ram
Messages: 11
Registered: July 2012
Junior Member
Hi guys,

I have a maven project and I have imported it into Eclipse.

I have successfuly run a few unit tests before, but after a few maven builds on the command line and then refresing on eclipse, I get a failure.

Class not found com.company.search.repo.impl.DefaultCusRepoUnitTest
java.lang.ClassNotFoundException: com.company.search.repo.impl.DefaultCusRepoUnitTest
	at java.net.URLClassLoader.findClass(URLClassLoader.java:419)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:345)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



Where in Eclipse, do I start to investigate what is wrong? And if you know how to solve it permanently it would be great.

I know I can get this to work by cleaning, rebuilding, etc...

Regards
Kris
Re: ClassNotFoundException when running JUnit test [message #903370 is a reply to message #903319] Thu, 23 August 2012 07:37 Go to previous message
Kris Ram is currently offline Kris Ram
Messages: 11
Registered: July 2012
Junior Member
I imported the project in STS 2.6.0 and ran the test again and it worked.


I noticed one difference, in the target folder the are 2 folders; classes and test-classes.

Previously the test-classes folder was not populated and it now contains all the test classes.


I can't confirm why it is generated now and not before though.

Hope somebody has some answers.

Previous Topic:cannot resolve org.eclipse.org.boot
Next Topic:Debugging not working while running works
Goto Forum:
  


Current Time: Fri Jul 25 14:36:05 EDT 2014

Powered by FUDForum. Page generated in 0.02082 seconds