请问为何Eclipse JUnit总是报告找不到类? 可是都在啊
报错找不到类,可是junit.jar 就在WEB-INF的lib文件夹下,可是Eclipse自己又出来个jUnit3或者4,怎么也甩不掉,也不知如何添加,build.xml下将servlet的处理xml定义在了WEB-INF的spring-app.xml下,里面是所有的bean和测试bean,怎么就不行呢?
求问各路神仙了!!
Class not found springapp.web.InventoryControllerTests
java.lang.ClassNotFoundException: springapp.web.InventoryControllerTests
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
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)
Class not found springapp.web.HelloControllerTests
java.lang.ClassNotFoundException: springapp.web.HelloControllerTests
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
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)
[解决办法]
要不你把自己的删了试试。 然后在 工程java Build Path中 Libraris 下 Add Library添加它自带的Junit的jar包
[解决办法]
楼主去确认下代码和classpath中没有错误提示,
从java.lang.ClassNotFoundException: springapp.web.HelloControllerTests这句来看,应该类有编译错误,没有通过编译。
[解决办法]
检查你的jdk版本