weblogic+cxf环境下报错
由于项目需要要学webservice,一开始就遇到这个异常;
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:171)
at $Proxy11.sayHello(Unknown Source)
at com.test.cxf.Client.main(Client.java:18)
Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1900)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1828)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:590)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 7 more
以下为客户端调用webservice的代码:
public String caculateYaocjh(){
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean ();
factory.setServiceClass(IYaoHLJhService.class);
factory.setAddress("http://localhost:8085/athena/services/yaocjhService");
try{
IYaoHLJhService hs= (IYaoHLJhService) factory.create();
hs.createYaoHLJhMx();
} catch (Exception e) {
throw new ActionException(e.getMessage());
}
//消息
Map<String, String> message = new HashMap<String, String>();
message.put("message", "webService自动调度要车计算完成");
setResult("result",message);
return AJAX;
}
网上有很多说法:
比如:
spring cxf 异常:
有两个原因:
-
客户端的接口的包名(或者接口名)和服务端的包名(或者接口名)不一致
- 客户端的接口没有加上@Webservice注解
比如:
让sun的https handler优先加载;
为程序添加weblog.xml配置文件;
这些都没有解决我的问题,最后看到一篇好文章,解决了我的问题。
这一点要知道:
目前最新规范是 JAX-WS(区别与JAX-RPC),可以下载jaxws-ri(sun的参考实现)学习(samples/fromwsdl)。基本原理了解后,具体开发依赖于你选择的开发平台,Apache CXF、Apache Axis2,weblogic,websphere都有相应的处理方法。其中Weblogic11g是基于jaxws-ri的,他们是一家的。
webservice与xfire实现的网上有很多,都是正确的。
这个讲得很全,见:http://atomti.iteye.com/blog/476408
webservice与CXF的这个讲得很全,见:http://blog.csdn.net/cyf_cyf/article/details/7187911
我的错误问题在这里:
factory.setAddress("http://localhost:8085/athena/services/yaocjhService");
将这一句代码改为下面的形式就可以正确执行了:
factory.setAddress("http://localhost:8085/athena/services/yaocjhService?wsdl");
分享到:
相关推荐
apache-cxf-2.4.6.zip
抛出无法找到主类:org.apache.axis.wsdl.WSDL2Java(Throws Could not find main class: org.apache.axis.wsdl.WSDL2Java)。 添加本文的jar包压缩包解压出来的所有jar包到当前使用的java.exe 命令的lib目录下的ext...
java通过cxf实现webservice所需jar包。java通过cxf实现webservice所需jar包。
通过CXF方式创建带用户认证的Webservice接口(含调用程序)与SSH框架完美整合。
一个有关于并行计算的地球物理正演项目报告。基于GPU计算
apache-cxf-2.7.7以及cxf客户端所需要的jar包,命令生成webservice客户端
TipTec.Developing.Web.Services.with.Apache.CXF.and.Axis2.Jan.2010.rar
s.addLocation(StaxUtils.java:1038) at org.apache.cxf.staxutils.StaxUtils.startElement(StaxUtils.java:893) at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:965) at org.apache.cxf....
org.apache.cxf.spring.remoting.Jsr181HandlerMapping.jar
Maven坐标:org.apache.cxf:cxf-rt-frontend-simple:3.0.1; 标签:cxf、rt、apache、simple、frontend、jar包、java、API文档、中文版; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览...
cxf调用webservice,客户端最少jar包,只需4个,告别找jar包的繁琐
cxf客户端调用axis服务端流程
Maven坐标:org.apache.cxf:cxf-rt-bindings-soap:3.0.1; 标签:cxf、rt、apache、bindings、jar包、java、API文档、中文版; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。...
CXF 框架实战代码---服务器端发布WebServices接口。服务器端发布WebServices接口
Maven坐标:org.apache.cxf:cxf-core:3.0.1; 标签:cxf、core、apache、jar包、java、API文档、中文版; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中...
CXF文档已经 所依赖的jar全部在里面
Apache CXF = Celtix + XFire,开始叫 Apache CeltiXfire,后来更名为 Apache CXF 了,以下简称为 CXF。CXF 继承了 Celtix 和 XFire 两大开源项目的精华,提供了对 JAX-WS 全面的支持,并且提供了多种 Binding 、...
| 176 - org.apache.cxf.cxf-api - 2.7.0.redhat-610379 | 应用程序 { 已经抛出异常,现在展开 org.apache.cxf.interceptor.Fault:配置问题:无法为 XML 架构命名空间 [ ] 找到 Spring NamespaceHandler 违规资源...
CXF是一个很好用的web service框架,但是部署在WebSphere上容易出现问题,这是收集到的解决这些问题的方法。