Class not found...controller.TestPageHelper
来源:互联网 发布:淘宝直通车使用条件 编辑:程序博客网 时间:2024/06/05 18:50
问题描述
maven创建的项目,通过run as maven build启动后,测试类统统出现Class not found异常,有时候打开eclipse直接调试测试类的时候又是好好的,有时候maven build以后就出问题
Class not found zyh.controller.TestPageHelper
java.lang.ClassNotFoundException: zyh.controller.TestPageHelperat java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:685)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
解决办法
方法1:maven build的命令,只用tomcat7:run就行了(根据你的tomcat的版本来,我在配置里用的7),前面就不要加clean了,因为你每次clean了,编译出来的测试类的文件就被清除了。这样,不论你是否build了maven工程,进行Junit单元测试都不会受影响
方法2:maven build的命令如果是 clean tomcat7:run,那么你要进行Junit单元测试的时候,你的测试类就需要重新编译,方法就是在你的测试类里面随便找个位置敲个空格或者在哪里随便enter一行,然后Ctrl+S进行保存,这下你就有了编译后的文件。现在进行你的单元测试吧。
阅读全文
0 0
- Class not found...controller.TestPageHelper
- CodeIgniter PHP Fatal error: Class 'Controller' not found
- Class 'app\api\controller\v1\TestValidate' not found 解决办法
- Class TToolButton not found
- Class 'SQLite3' not found
- class not found exception
- eclipse Class Not Found
- Class not found
- Class 'DOMDocument' not found
- Class Not Found Exception
- Dialect class not found
- Action class [*.*.*] not found
- JUnit报错:java.lang.ClassNotFoundException: com.taotao.controller.TestPageHelper
- Class not found Test.TestHibernateJunit
- class not found错误解决办法
- Class Not Found Exception解决
- Android Activity Class Not found
- Error: Class 'SimplePasswordHasher' not found
- 求最长回文子串
- Leetcode(W8):121. Best Time to Buy and Sell Stock(动态规划)
- JAVA口碑IDE工具IntelliJ IDEA入门高清
- 数据结构实验之二叉树一:树的同构
- 【JavaScript】return的用法
- Class not found...controller.TestPageHelper
- 元组
- 51单片机 主从机模拟 spi通讯
- String to Integer (atoi)算法
- 本地图片如何插入到html文件中
- 数据结构实验之二叉树六:哈夫曼编码
- Java中Date类型24小时制和12小时制
- Spring4+Springmvc+quartz实现多线程动态定时调度
- [Python学习]map与reduce函数