ClassNotFoundException

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ClassNotFoundException

test

eclipse使用main函数可以对应的方法可以跑起来,
但使用junit跑testrunner报错如下:
Class not found TestRunner
java.lang.ClassNotFoundException: TestRunner
        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:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)


对应的java文件打包成jar后,放到网页版验证脚本,提示错误
java.lang.ClassNotFoundException: org.springframework.context.support.AbstractApplicationContext
对应的jar包已经放在resources下,class文件也放在TestRunner.groovy同一个文件夹下
求大神指点!
Reply | Threaded
Open this post in threaded view
|

RE: ClassNotFoundException

Mavlarn

是执行groovy脚本吗?

 

如果在eclipse里面执行,在网页上生成groovy maven项目,下载,然后倒入到eclipse里面,这样需要的依赖都已经在maven的pom文件里面定义好了,直接按照junit test执行即可。在网页上验证的话,对于这种groovy maven测试项目,也不需要自己打包在上传。如果一定要自己打包的话,应该是要用"mvn package", 而不是"mvn jar"

 

没有明白你说的main函数执行是什么意思?

 

-----Original Message-----
From: "test [via ngrinder]"<[hidden email]>
To: "Mavlarn"<[hidden email]>;
Cc:
Sent: 2015-01-19 (星期一) 16:51:43
Subject: ClassNotFoundException
 


eclipse使用main函数可以对应的方法可以跑起来,
但使用junit跑testrunner报错如下:
Class not found TestRunner
java.lang.ClassNotFoundException: TestRunner
        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:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)


对应的java文件打包成jar后,放到网页版验证脚本,提示错误
java.lang.ClassNotFoundException: org.springframework.context.support.AbstractApplicationContext
对应的jar包已经放在resources下,class文件也放在TestRunner.groovy同一个文件夹下
求大神指点!


If you reply to this email, your message will be added to the discussion below:
http://ngrinder.642.n7.nabble.com/ClassNotFoundException-tp1714.html
To start a new topic under ngrinder-user-cn, email [hidden email]
To unsubscribe from ngrinder-user-cn, click here.
NAML