|
Hi!
I keep getting "Class not found" when I run/debug JUnit tests (I haven't checked if the pro blem exists when running an actual Java application). If I do a Project Clean in Eclipse and the project is rebuilt then everything works as expected. Is seems as if when the classes are built by Maven from the prompt/CLI then Eclipse can't find the class file. A diff of the target directory doesn't show any relevant differences. Regards, Jimisola Class not found se.company.SomeClass java.lang.ClassNotFoundException: se.company.SomeClass at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadSuiteClass(RemoteTestRunner.java:428) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:380) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) |
|
After you run a JUnit test in eclipse you can go to the debug perspective and right click on the, now terminated, run entry and select 'properties.' The box that pops up will show the classpath that was used for running the test.
Sometimes this is useful in determining what is going on. I find that things on the Maven Classpath often get left off of the classpath for JUnit tests. I will check whether a 'clean' in eclipse will fix the problem. Thanks. -- Lee On 6/26/06, Jimisola Laursen <[hidden email]> wrote:
-- -- Lee Meador Sent from gmail. My real email address is [hidden email] |
|
Thanks for the reply. I didn't know about the properties option and hence being able to see the classpath.
I will check this next time I get this error and hopefully I'll have enough information to provide a detailed bug report. Regards, Jimisola |
|
Hi,
I think we just solved that problem almost by accident... In the project containing your tests, edit Java Build Path | Order and Export. Make sure M2 Dependencies appears BEFORE JRE System Library. Regards, Diego |
|
Nice! Thanks.
That seemed to be the trick. Do you want to have to honor of filing a bug report or should I? Regards, Jimisola |
|
I suspect this is the same issue as [ <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://jira.codehaus.org/browse/MNGECLIPSE-18?page=all" target="_blank">http://jira
.codehaus.org/browse/MNGECLIPSE-18?page=all ]
On 7/23/06, doballve <[hidden email]> wrote:
-- -- Lee Meador Sent from gmail. My real email address is [hidden email] |
|
No, I don't think so as that was fixed for 0.0.4 and this happens with 0.0.9.
The solution here seem to be to reorder Java Build Path, but I might be wrong... Jimisola
|
|
As I recall, that issue was closed because it couldn't be duplicated. That's different than "fixed."
I suspect that some settings and organizations of projects cause it to pop up. I have not had time to pare my projects down to the point that removing one more thing makes the problem go away. It's been happening to me for a long time. BTW - Rearranging the order of things in the classpath, as described previously in this thread, does not always fix the problem for me. It does in some projects and doesn't in others. I don't know exactly how to predict it occurring. Thanks. -- Lee On 7/27/06, Jimisola Laursen <[hidden email]> wrote:
-- -- Lee Meador Sent from gmail. My real email address is [hidden email] |
|
public static void main(String[] args) {
junit.textui.TestRunner.run(YourClass.class); } if you forget these code you will Class not found exception |
|
Don't believe I have this section of code. Are you sure about this?
The "Class not found" occurs every now and then - can you explain that? Regards, Jimisola
|
| Powered by Nabble | Edit this page |
