CXF 客户端调用时出错
客户端调用代码:
URLwsdlURL=DataDownloaderService.WSDL_LOCATION;
DataDownloaderServicess=newDataDownloaderService(wsdlURL,SERVICE_NAME);
DataUpdateServiceport=ss.getDataDownloaderPort();
org.apache.cxf.endpoint.Clientclient=ClientProxy.getClient(port);
org.apache.cxf.endpoint.EndpointcxfEndpoint=client.getEndpoint();
Map<String,Object>outProps=newHashMap<String,Object>();
outProps.put(WSHandlerConstants.ACTION,WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER,"joe");
outProps.put(WSHandlerConstants.PASSWORD_TYPE,WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,ClientPasswordCallback.class.getName());
org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor();
WSS4JOutInterceptorwssOut=newWSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
response=port.getRequestUpdateData(request);
执行代码后报错如下:
2011-4-1716:04:38org.apache.cxf.service.factory.ReflectionServiceFactoryBeanbuildServiceFromWSDL
信息:CreatingService{http://update.server.synch_data.boling.com/}DataDownloaderServicefromWSDL:http://localhost:8084/synchData/services/DownloadData?wsdl
2011-4-1716:04:51org.apache.cxf.phase.PhaseInterceptorChaindoDefaultLogging
警告:Interceptorfor{http://update.server.synch_data.boling.com/}DataDownloaderService#{http://update.server.synch_data.boling.com/}getRequestUpdateDatahasthrownexception,unwindingnow
org.apache.cxf.interceptor.Fault:Responsewasofunexpectedtext/htmlContentType.IncomingportionofHTMLstream:<html><head><title>ApacheTomcat/6.0.26-Errorreport</title><style><!--H1{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}H2{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}H3{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}BODY{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}B{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}P{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A{color:black;}A.name{color:black;}HR{color:#525D76;}--></style></head><body><h1>HTTPStatus500-</h1><HRsize="1"noshade="noshade"><p><b>type</b>Exceptionreport</p><p><b>message</b><u></u></p><p><b>description</b><u>Theserverencounteredaninternalerror()thatpreventeditfromfulfillingthisrequest.</u></p><p><b>exception</b><pre>javax.servlet.ServletException:Servletexecutionthrewanexception
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
</pre></p><p><b>rootcause</b><pre>java.lang.IncompatibleClassChangeError:Expectedstaticfieldorg.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.secEngine
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getSecurityEngine(WSS4JInInterceptor.java:595)
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:168)
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:80)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:188)
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
</pre></p><p><b>note</b><u>ThefullstacktraceoftherootcauseisavailableintheApacheTomcat/6.0.26logs.</u></p><HRsize="1"noshade="noshade"><h3>ApacheTomcat/6.0.26</h3></body></html>
atorg.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:79)
atorg.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
atorg.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:755)
atorg.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2335)
atorg.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2193)
atorg.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2037)
atorg.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
atorg.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:697)
atorg.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
atorg.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
atorg.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
atorg.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
atorg.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
atorg.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
atorg.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at$Proxy29.getRequestUpdateData(UnknownSource)
atcom.boling.synch_data.server.update.DataUpdateService_DataDownloaderPort_Client.downloadData(DataUpdateService_DataDownloaderPort_Client.java:55)
atcom.boling.data_update.utils.ServiceProxy.invokeBytableName(ServiceProxy.java:56)
atcom.boling.data_update.utils.ServiceProxy.getDataFrByTableName(ServiceProxy.java:37)
atcom.boling.data_update.ServiceClient.synchDataWithServer(ServiceClient.java:30)
atcom.boling.data_update.ServiceClient.main(ServiceClient.java:119)
这个到底是啥错误?我都调试一个下午了