您好,登錄后才能下訂單哦!
如題所示,使用Apache CXF開發(fā)web service時(shí),使用SoapUI對(duì)web service接口進(jìn)行測(cè)試時(shí)報(bào)了以下錯(cuò)誤:
org.apache.cxf.interceptor.Fault: object is not an instance of declaring class while invoking public abstract java.lang.String cn.zifangsky.service.CXFService.sayHello(java.lang.String) with params [dddd]. at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:267) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:232) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:85) ...
這個(gè)bug的出現(xiàn)是在配置文件這里:
<jaxws:server id="sayHelloServices" serviceClass="cn.zifangsky.service.CXFService" address="/services/soap" > <jaxws:serviceBean> <bean class="cn.zifangsky.service.impl.CXFServiceImpl" /> </jaxws:serviceBean> <jaxws:outInterceptors> <ref bean="outLoggingInterceptor" /> </jaxws:outInterceptors> <jaxws:inInterceptors> <ref bean="inLoggingInterceptor" /> </jaxws:inInterceptors> <jaxws:features> <ref bean="loggingFeature" /> <wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing" /> </jaxws:features> </jaxws:server>
其中,<jaxws:serviceBean>需要對(duì)應(yīng)的是webservice接口的實(shí)現(xiàn)類,如果填錯(cuò)了則會(huì)出現(xiàn)上面的bug。當(dāng)然我當(dāng)時(shí)是犯了一個(gè)低級(jí)的錯(cuò)誤,那就是CXFServiceImpl這個(gè)類忘記實(shí)現(xiàn)CXFService接口了,真是汗顏
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。