折磨人的cxf ws配置问题
来源:互联网 发布:星星知我心主题曲歌词 编辑:程序博客网 时间:2024/05/21 20:50
1、因为在web.xml中的配置如下
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
在beans中定义为:
<jaxws:endpoint
id="increaseUserScore"
implementor="test.wintalent.IncreaseUserScoreImpl"
address="/testservice/IncreaseUserScore" />
所以导致出现我在发布的时候出现
Exception in thread "main" java.lang.NullPointerException
at $Proxy45.addUserScore(Unknown Source)
at incScore.Client.main(Client.java:24)
而我访问的地址为http://localhost:8080/cxfSpring/testservices/IncreaseUserScore?wsdl
出现此异常Can't find the request for xxx's Observer
后来地址改为http://localhost:8080/cxfSpring/services/testservices/IncreaseUserScore?wsdl
后访问正常,原因是因为我在CXFServlet中配置加了services,如果不加的话,则访问方法正常
注意,通过访问http://localhost:8080/cxfSpring/services 能看到工程中的所有发布的接口,此时点击相应接口链接即可看成完整的接口访问地址和对应的xml信息(注:若在web.xml中CXFServlet的url-pattern标签中的值为/*则访问地址为http://localhost:8080/cxfSpring/);
2、jar包冲突,导致出现以下异常,可是在服务器端查看已实现正常调用
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
at javax.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:140)
at org.apache.cxf.attachment.AttachmentUtil.<clinit>(AttachmentUtil.java:61)
at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:61)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:733)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2201)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2071)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1925)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:662)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy35.addUserScore(Unknown Source)
at incScore.Client.main(Client.java:24)
后来把公司框架里的jar包全拷进去,把cxf 2.3.0的jar包全去掉后,就好了,注:我的工程用的是jdk 5.0的,因为公司框架中之前有人做过cxf的,就好了,只是具体是哪一个jar包的问题,由于项目中要用就没去仔细研究了,如果有哪位朋友看知道了,麻烦来blog回复下!
3、获取值时报空值针异常,信息如下:
Exception in thread "main" java.lang.NullPointerException
at $Proxy45.addUserScore(Unknown Source)
at incScore.Client.main(Client.java:24)
我代码的第24行为:调用接口的代码
原因是:在服务器端口没有设置@WebResult(name="addUserScoreResult"),而我在写客户端接口时使用了它,故出现此异常!
ice(targetNamespace = "http://wintalent.test/")
public interface IncreaseUserScore {
@WebMethod(operationName="addUserScore")
public @WebResult(name="addUserScoreResult")
boolean addUserScore(@WebParam(name = "username") String username,
@WebParam(name = "password") String password,
@WebParam(name = "addScoreEmail") String addScoreEmail,
@WebParam(name = "type") Integer type);
@WebMethod(operationName="addUserScoreByUser")
public @WebResult(name="addUserScoreByUserResult")
boolean addUserScoreByUser(@WebParam(name = "rmiUser") CxfWebseriviceUser rmiUser,
@WebParam(name = "addScoreEmail") String addEmail,
@WebParam(name = "type") Integer type);
}
- 折磨人的cxf ws配置问题
- 折磨人的Xdebug 安装配置
- 折磨人的两个小问题[IOS]
- webservice cxf+spring+WS-security配置示例
- WS (CXF) JAX-WS
- Cxf+wss4j的WS-Security实现
- cxf + spring 的WS-Security示例
- cxf + spring 的WS-Security示例
- 简单的Jax-WS WebService实现-cxf
- 碎片感悟,折磨人的PlaceholderFragment,折磨人的fragment_main
- 感谢折磨你的人
- 折磨人的EL表达式
- 折磨人,中国人的最爱
- 链表,折磨人的数据结构
- 关于cxf的环境配置问题
- CXF 发布WS 1 counts of IllegalAnnotationExceptions 问题
- CXF+WS-Security+Spring WebService服务器端+客户端及注意问题
- cxf和spring的整合出现的问题:javax.xml.ws.soap.SOAPFaultException: Cannot create a secure XMLInputFactory
- Unicode编码表到GB2312编码表映射表 收藏
- 多表关联查询的一点亲身体会
- Design Pattern - Prototype(C#)
- WEB环境下网站架构的8大特性总结
- 很简单的定时刷新
- 折磨人的cxf ws配置问题
- 初识JFreeChart
- alloc_skb()
- c++ 标准模板库 List
- 取农历日期
- Asp.net mvc3 不支持vs2008
- [转]memcache 的源代码分析
- Centos下测试硬盘读写速度
- ASCII码表完整版