问答详情
源自:4-8 DAO层单元测试编码和问题排查(上)

java.lang.ClassNotFoundException: org.seckill.dao.SeckillDaoTest

Class not found org.seckill.dao.SeckillDaoTest

java.lang.ClassNotFoundException: org.seckill.dao.SeckillDaoTest

at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

at java.lang.ClassLoader.loadClass(ClassLoader.java:423)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

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)


提问者:mjka5632 2016-11-29 18:43

个回答

  • _白驹过隙_
    2017-02-18 22:26:12

    打开工程的.classpath文件:

    <?xml version="1.0" encoding="UTF-8"?>

    <classpath>

        <classpathentry kind="src" path="src/main/java"/>

        <classpathentry kind="src" path="src/main/config"/>

        <classpathentry kind="src"  path="src/test/java"/>

                    .......

    </classpath

       

      

    将output="target/test-classes"加上就好用了


       

    <?xml version="1.0" encoding="UTF-8"?>

    <classpath>

        <classpathentry kind="src" path="src/main/java"/>

        <classpathentry kind="src" path="src/main/config"/>

        <classpathentry kind="src"  output="target/test-classes" path="src/test/java"/>

       


  • qq_浪_0
    2016-11-30 18:55:53

    没有找到该类,说明没有编译成功
    1.可能是环境变量配置有问题
    2.jar包有错误,查看jar是否有漏或者重新导入jar包
    3.可能你用了不存在的类
    4.版本不一致,jdk的版本