我遇到JAXB的问题,当我进行soap调用时,它会返回一个jaxb异常: 该上下文不知道该请求,但是maven成功创建了wsdl。 我的班级:
这是我的提供者:
@Service
public class ChangeKeysServiceProvider extends GenericServiceProvider {
private static final Logger logger = LoggerFactory.getLogger(ChangeKeysServiceProvider.class);
public ChangeKeysServiceResponse doService(ChangeKeysServiceRequest request) {
if (logger.isTraceEnabled()) {
logger.trace("Starting request");
}
BSRChangeKeysServiceProxy proxy = getProxy(getProxyClass());
proxy.setParams(request.getFilterIn());
proxy.setHeaderAttributes(fillServiceHeader(request.getServiceContext()));
ChangeKeysServiceResponse response = null;
try {
proxy.performService();
response = new ChangeKeysServiceResponse();
} catch (ServiceException e) {
response = new ChangeKeysServiceResponse();
response.setReturnCode(e.getErrorCode());
response.addErrorMessage(e.getMessage());
logger.error("An error occurred invoking request", e);
}
if (logger.isTraceEnabled()) {
logger.trace("Starting request...DONE!");
}
return response;
}
protected Class <BSRChangeKeysServiceProxy> getProxyClass() {
return BSRChangeKeysServiceProxy.class;
}
}
这是我的要求:
public class ChangeKeysServiceRequest extends GenericServiceRequest {
private ParamCambioPwd filterIn;
public ParamCambioPwd getFilterIn() {
return filterIn;
}
public void setFilterIn(ParamCambioPwd filterIn) {
this.filterIn = filterIn;
}
}
(在ParamCambioPwd中我只有Get和Set about String,long和boolean。)
当我进行SOAP调用时,它返回以下异常:
[11/07/14 15.01.14:475 CEST] 00000085 RemoteExcepti E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "ChangeKeys" on bean "BeanId(IB_MultiChannelServices_EAR#IB_MultiChannelServices.war#GWSicurezza, null)". Exception data: javax.xml.ws.WebServiceException: javax.xml.bind.JAXBException:x.service.provider.modificapasswordaccesso.ChangeKeysServiceRequest is not known to this context
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller.demarshalRequest(DocLitWrappedMinimalMethodMarshaller.java:273)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.createRequestParameters(JavaBeanDispatcher.java:322)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:102)
at com.ibm.ws.websvcs.server.dispatcher.EJBBeanDispatcher.invoke(EJBBeanDispatcher.java:80)
at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:111)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:208)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1570)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1225)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:775)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:457)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at x.ws.logging.SoapLoggingFilter.doFilter(SoapLoggingFilter.java:70)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:908)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815)
Caused by: javax.xml.bind.JAXBException: x.service.provider.modificapasswordaccesso.ChangeKeysServiceRequest is not known to this context
at com.ibm.jtc.jax.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:642)
at com.ibm.jtc.jax.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getBeanInfo(UnmarshallerImpl.java:568)
at com.ibm.jtc.jax.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:353)
at com.ibm.xml.xlxp2.jaxb.unmarshal.UnmarshallerProxy.unmarshal(UnmarshallerProxy.java:198)
at org.apache.axis2.datasource.jaxb.JAXBDSContext$2.run(JAXBDSContext.java:688)
at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.unmarshalByType(JAXBDSContext.java:592)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.unmarshal(JAXBDSContext.java:351)
at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._getBOFromReader(JAXBBlockImpl.java:96)
at org.apache.axis2.jaxws.message.impl.BlockImpl._getBOFromOM(BlockImpl.java:476)
at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._getBOFromOM(JAXBBlockImpl.java:136)
at org.apache.axis2.jaxws.message.impl.BlockImpl.getBusinessObject(BlockImpl.java:148)
at org.apache.axis2.jaxws.message.impl.XMLSpineImpl._getBlockFromOMElement(XMLSpineImpl.java:616)
at org.apache.axis2.jaxws.message.impl.XMLSpineImpl.getBodyBlock(XMLSpineImpl.java:320)
at org.apache.axis2.jaxws.message.impl.XMLPartBase.getBodyBlock(XMLPartBase.java:509)
at org.apache.axis2.jaxws.message.impl.MessageImpl.getBodyBlock(MessageImpl.java:512)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller.getPDElementsForDocLitWrappedMinimal(DocLitWrappedMinimalMethodMarshaller.java:868)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller.demarshalRequest(DocLitWrappedMinimalMethodMarshaller.java:246)
... 39 more
[11/07/14 15.01.14:478 CEST] 00000085 AxisEngine E org.apache.axis2.engine.AxisEngine receive javax.xml.bind.JAXBException: x.provider.modificapasswordaccesso.ChangeKeysServiceRequest is not known to this context
org.apache.axis2.AxisFault: javax.xml.bind.JAXBException: x.provider.modificapasswordaccesso.ChangeKeysServiceRequest is not known to this context
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:242)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:208)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1570)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1225)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:775)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:457)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at x.logging.SoapLoggingFilter.doFilter(SoapLoggingFilter.java:70)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:908)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815)
Caused by: javax.xml.ws.WebServiceException: javax.xml.bind.JAXBException: x.service.provider.modificapasswordaccesso.ChangeKeysServiceRequest is not known to this context
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller.demarshalRequest(DocLitWrappedMinimalMethodMarshaller.java:273)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.createRequestParameters(JavaBeanDispatcher.java:322)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:102)
at com.ibm.ws.websvcs.server.dispatcher.EJBBeanDispatcher.invoke(EJBBeanDispatcher.java:80)
at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:111)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
... 34 more
Caused by: javax.xml.bind.JAXBException: x.service.provider.modificapasswordaccesso.ChangeKeysServiceRequest is not known to this context
at com.ibm.jtc.jax.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:642)
at com.ibm.jtc.jax.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getBeanInfo(UnmarshallerImpl.java:568)
at com.ibm.jtc.jax.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:353)
at com.ibm.xml.xlxp2.jaxb.unmarshal.UnmarshallerProxy.unmarshal(UnmarshallerProxy.java:198)
at org.apache.axis2.datasource.jaxb.JAXBDSContext$2.run(JAXBDSContext.java:688)
at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.unmarshalByType(JAXBDSContext.java:592)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.unmarshal(JAXBDSContext.java:351)
at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._getBOFromReader(JAXBBlockImpl.java:96)
at org.apache.axis2.jaxws.message.impl.BlockImpl._getBOFromOM(BlockImpl.java:476)
at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._getBOFromOM(JAXBBlockImpl.java:136)
at org.apache.axis2.jaxws.message.impl.BlockImpl.getBusinessObject(BlockImpl.java:148)
at org.apache.axis2.jaxws.message.impl.XMLSpineImpl._getBlockFromOMElement(XMLSpineImpl.java:616)
at org.apache.axis2.jaxws.message.impl.XMLSpineImpl.getBodyBlock(XMLSpineImpl.java:320)
at org.apache.axis2.jaxws.message.impl.XMLPartBase.getBodyBlock(XMLPartBase.java:509)
at org.apache.axis2.jaxws.message.impl.MessageImpl.getBodyBlock(MessageImpl.java:512)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller.getPDElementsForDocLitWrappedMinimal(DocLitWrappedMinimalMethodMarshaller.java:868)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller.demarshalRequest(DocLitWrappedMinimalMethodMarshaller.java:246)
... 39 more
我如何解决这个问题?