CXF调用webservice报错
程序员文章站
2022-06-11 08:22:58
...
public static void main(String[] args) {
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
Client client = null;
client = clientFactory.createClient("http://localhost:8080/bnc?wsdl");
try {
Object[] result = client.invoke("sayHi", "wlh");
System.out.println(result[0]);
} catch (Exception e) {
e.printStackTrace();
}
}
2013-7-30 21:28:11 org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames
信息: Created classes: org.crazyit.cxfapp.service.ObjectFactory, org.crazyit.cxfapp.service.SayHi, org.crazyit.cxfapp.service.SayHiResponse, org.crazyit.cxfapp.service.SayHiToUser, org.crazyit.cxfapp.service.SayHiToUserResponse, org.crazyit.cxfapp.service.User
Exception in thread "main" java.lang.NullPointerException
at org.apache.cxf.common.util.Compiler.useJava6Compiler(Compiler.java:190)
at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:144)
at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:139)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.compileJavaSrc(DynamicClientFactory.java:610)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:369)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:240)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:233)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:188)
at org.crazyit.cxfapp.bnc.MyClient.main(MyClient.java:16)
报这个错的原因是因为:1.你环境变量设置有错(网上有人说吧jre改成jdk的jre,主要原因是因为你环境变量设置有错。)
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
Client client = null;
client = clientFactory.createClient("http://localhost:8080/bnc?wsdl");
try {
Object[] result = client.invoke("sayHi", "wlh");
System.out.println(result[0]);
} catch (Exception e) {
e.printStackTrace();
}
}
2013-7-30 21:28:11 org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames
信息: Created classes: org.crazyit.cxfapp.service.ObjectFactory, org.crazyit.cxfapp.service.SayHi, org.crazyit.cxfapp.service.SayHiResponse, org.crazyit.cxfapp.service.SayHiToUser, org.crazyit.cxfapp.service.SayHiToUserResponse, org.crazyit.cxfapp.service.User
Exception in thread "main" java.lang.NullPointerException
at org.apache.cxf.common.util.Compiler.useJava6Compiler(Compiler.java:190)
at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:144)
at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:139)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.compileJavaSrc(DynamicClientFactory.java:610)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:369)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:240)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:233)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:188)
at org.crazyit.cxfapp.bnc.MyClient.main(MyClient.java:16)
报这个错的原因是因为:1.你环境变量设置有错(网上有人说吧jre改成jdk的jre,主要原因是因为你环境变量设置有错。)
上一篇: hibernate4 No Session found for current thread
下一篇: Illegal character (NULL, unicode 0) encountered: not valid in any content
推荐阅读
-
java调用webservice实例 javaxml
-
jQuery AJAX 调用 WebService 的实例_PHP教程
-
求高人指点.net开发的webservice调用外部php写的webservice
-
在WAMPServer环境下调用SpawEditor总报错,不知如何正确设置访问路径
-
PHP调用C#Webservice如果判断是否有数据呢?
-
PHP使用SOAP调用.net的WebService数据_PHP
-
PHP用cURL调用WebService获取天气信息
-
c#动态调用Webservice的两种方法实例
-
ASP.NET如何定时调用WebService服务
-
C# Soap调用WebService的实例