(1)Please enable FINE/TRACE log level for more details.
用HttpClient(版本4.0)方式访问cxf-webservice,我用Get方式访问没有问题,但是改成Post方式就出错。
参考:http://bbs.csdn.net/topics/390064922
(2)CXF拦截器实现过程中
import org.springframework.stereotype.Service;
/**
* 对返回给客户端的结果进行处理
* @author qihaishen
*
*/
@Service("gatewayOutInterceptor")
publicclass GatewayOutInterceptor extends AbstractPhaseInterceptor<Message> {
报如下错误错:
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restServiceContainer': Cannot resolve reference to bean 'gatewayOutInterceptor' while setting bean property 'outInterceptors' with key [1]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'gatewayOutInterceptor' is defined
。。。。。。org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
。。。。。
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'gatewayOutInterceptor' is defined
at
解决方案:
javax/persistence/Entity这个类找不到。是少了ejb3-persistence.jar这个包。
以上方案不行,手动将bean写入spring容器中。
(3)JAXB将Java对象转XML,为null的节点不显示
参考:
在实体类前,增加@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) 注解
JSON原来经过JACKSON转换以后为{"name":"name","sex":null}
加入注解后,结果为{"name":"name"}
sex节点被去掉了
(2)问题解决了嘛,@XmlElement(required=ture),我试了试,好像也不行。
正解: @XmlElement(nillable=true)
以上注解只是适合xml,但对于返回的json格式的报文,为:
{"regOrg":{"@xsi.nil":"true"},"settleFlowNo":"0003"}
写的太随便,还请见谅,但愿能帮到那谁谁谁!!!