问题描述
- webservice测试接口问题
-
当我运行我所测试的这个类的时候,就出错?appkey和地址都是正确的,为何一直出错呢?public static void getTotoo() {
ZJSClient zjsClient = new DefaultZJSClient("http://10.10.6.60:9999/zjs-noah-rest/clientBaseInfo/getClientBaseInfoByClientId","test",null);ClientBaseInfoGetRequest requet = new ClientBaseInfoGetRequest(); requet.setClientid("10086"); requet.setRequestId("12364"); requet.setTimestamp(new Date().getTime());// 如果没有设置会默认为当前时间 ClientBaseInfoGetResponse res=null; try { res = zjsClient.execute(requet); } catch (Exception e) { e.printStackTrace(); } System.out.println(res .getBody()); }
Exception in thread "main" java.lang.NoClassDefFoundError: org/glassfish/jersey/client/ClientConfig
at client.api.internal.util.WebUtils.doPost(WebUtils.java:43)
at client.api.DefaultZJSClient.doPost(DefaultZJSClient.java:264)
at client.api.DefaultZJSClient._execute(DefaultZJSClient.java:180)
at client.api.DefaultZJSClient.execute(DefaultZJSClient.java:118)
at com.epoch.cc.totoo.totoo.getTotoo(totoo.java:35)
at com.epoch.cc.totoo.totoo.main(totoo.java:44)
Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.client.ClientConfig
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 6 more
解决方案
少了jar包,,导入jersey的jar包就行了
解决方案二:
webservice接口问题
webservice接口测试
Webservice接口解析XML文件中文乱码问题