|
在eclipse下调试通过的代码挪到loadrunner的javauser下却报空指针异常。大侠们出来指点一下吧。
脚本如下:
import lrapi.lr;
import java.net.MalformedURLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.caucho.hessian.client.HessianProxyFactory;
import com.yeepay.g3.utils.dal.facade.DALService;
public class Actions
{
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");
Map map = new HashMap();
map.put("orderNo", orderNo);
map.put("startDate", startDate);
map.put("endDate", endDate);
try {
DALService dalService = (DALService)factory.create(DALService.class, url);
String temp=String.valueOf(dalService);
lr.output_message(temp);
Map result = (Map)dalService.queryOne("TestOrder.selectWithDateRange", map);
System.out.println(result);
} catch (MalformedURLException e) {
System.out.println("occur exception: " + e);
}
return 0;
}//end of action
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 |
|