日期:2014-05-16 浏览次数:21173 次
最近在学习CXF,感觉这个东西真好用。不过,学习阶段永远是坎坷不平的,尤其是没有高人指点的情况之下,小弟资质愚钝,学了半天才悟出点道道,还TMD的遇到个傻逼问题,不过很快解决了。贴出来“以儆效尤”,呵呵、
2010-4-15 17:08:58 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
警告: Interceptor for {http://inter.cxfTest/}IHelloWorldService#{http://inter.cxfTest/}print has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: cxfTest.bean.Person
is not known to this context
at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:160)
at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:169)
at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:105)
at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:127)
at $Proxy35.print(Unknown Source)
at cxfTest.client.CxfClient.main(CxfClient.java:31)
Caused by: javax.xml.bind.MarshalException
?粉红色部分cxfTest.bean.Person 是个JavaBean,出现这个错误是因为我写了一个带参数的构造方法,没有无参的默认构造方法导致的原因,解决办法很简单,只能写个无参的构造方法了。