public int init() throws Throwable {
return 0;
}//end of init
public int action() throws Throwable {
String url = "http://172.17.102.133:8002/dal-hessian/hessian/DALService";
HessianProxyFactory factory = new HessianProxyFactory();
String orderNo = "1234567890dfsd";
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startDate = format.parse("2012-12-01 00:00:00");
Date endDate = format.parse("2012-12-31 00:00:00");
public int end() throws Throwable {
return 0;
}//end of end
}
日志如下:
Virtual User Script started at : 2012-06-28 20:05:08
Starting action vuser_init.
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Actions.
HessianProxy[http://172.17.102.133:8002/dal-hessian/hessian/DALService]
Error: System.err: java.lang.NullPointerException Error
System.err: at sun.misc.URLClassPath$3.run(URLClassPath.java:323) Error
System.err: at java.security.AccessController.doPrivileged(Native Method) Error
System.err: at sun.misc.URLClassPath.getLoader(URLClassPath.java:320) Error
System.err: at sun.misc.URLClassPath.getLoader(URLClassPath.java:297) Error
System.err: at sun.misc.URLClassPath.access$000(URLClassPath.java:59) Error
System.err: at sun.misc.URLClassPath$1.next(URLClassPath.java:194) Error
System.err: at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) Error
System.err: at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) Error
System.err: at java.security.AccessController.doPrivileged(Native Method) Error
System.err: at java.net.URLClassLoader$3.next(URLClassLoader.java:390) Error
System.err: at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) Error
System.err: at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) Error
System.err: at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) Error
System.err: at com.caucho.hessian.io.ContextSerializerFactory.initSerializerFiles(ContextSerializerFactory.java:335) Error
System.err: at com.caucho.hessian.io.ContextSerializerFactory.init(ContextSerializerFactory.java:280) Error
System.err: at com.caucho.hessian.io.ContextSerializerFactory.<init>(ContextSerializerFactory.java:120) Error
System.err: at com.caucho.hessian.io.ContextSerializerFactory.create(ContextSerializerFactory.java:145) Error
System.err: at com.caucho.hessian.io.SerializerFactory.<init>(SerializerFactory.java:114) Error
System.err: at com.caucho.hessian.io.SerializerFactory.<init>(SerializerFactory.java:107) Error
System.err: at com.caucho.hessian.io.HessianOutput.init(HessianOutput.java:110) Error
System.err: at com.caucho.hessian.io.HessianOutput.<init>(HessianOutput.java:90) Error
System.err: at com.caucho.hessian.client.HessianProxyFactory.getHessianOutput(HessianProxyFactory.java:499) Error
System.err: at com.caucho.hessian.client.HessianProxy.sendRequest(HessianProxy.java:278) Error
System.err: at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:170) Error
System.err: at $Proxy0.queryOne(Unknown Source) Error
System.err: at Actions.action(Actions.java:50) Error
Error: java.lang.NullPointerException
Error: at sun.misc.URLClassPath$3.run(URLClassPath.java:323)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
at sun.misc.URLClassPath.getLoader(URLC作者: anna03 时间: 2012-6-29 21:19
问题决绝了。原因说出来有点可笑,但是这个问题困扰了我一整天,开始我在百度上各种搜,发现提这个问题的很多,最后解决的只有一个帖子。所以我特意上来回帖讲讲我解决问题的过程。抛空指针首先想到的是引用或者传了空对象,于是我把用到的对象都打印出来了,没发现空的。于是就搜了第二行的报错信息,百度无果后我google了,搜出一堆,发现大家都在讨论环境什么的,(我英语2把刀!)硬着头皮仔细看了一下,发现有人通过回退jdk版本决绝了这个问题。于是我就F4了一下,classpath里的jdk版本和我eclipse用的是一样的。可见不是这个问题,我顺手拉了一下滚动条,发现有2行是红的,是两个db2的包!此时我仿佛明白了,我写脚本的时候default.cfg文件直接拷的以前脚本的,然后在ue里编辑的。前几天我刚好更新了本地仓库,所以以前用的db2的包被新版本代替了,以前的包没了。我重新添加了db2的jar包后问题解决了。
环境问题各不相同,此思路供大家参考!作者: 云层 时间: 2012-6-30 12:59
不错