Websphere上的Web服务客户端在方法调用上抛出NullPointer

时间:2014-08-19 12:59:03

标签: java spring websphere jax-ws

我们一直在使用

  • jaxws-spring
  • WebSphere 8.5.5.2

我们的网络服务互动,现在当我们在客户端调用任何网络方法时,我们会遇到这样的“原因” -

ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause appServlet: 
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is javax.xml.ws.soap.SOAPFaultException: java.lang.NullPointerException
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
.....
Caused by: javax.xml.ws.soap.SOAPFaultException: java.lang.NullPointerException
at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.createSystemException(MethodMarshallerUtils.java:1363)
at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.demarshalFaultResponse(MethodMarshallerUtils.java:1089)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMethodMarshaller.demarshalFaultResponse(DocLitWrappedMethodMarshaller.java:680)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.getFaultResponse(JAXWSProxyHandler.java:626)
....
Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:946)
at org.apache.axis2.jaxws.message.databinding.JAXBUtils.getJAXBContext(JAXBUtils.java:445)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.getJAXBContext(JAXBDSContext.java:228)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.getJAXBContext(JAXBDSContext.java:161)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshal(JAXBDSContext.java:396)
at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:189)
at org.apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java:371)
at org.apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java:295)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:781)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:967)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:207)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)

Web服务客户端初始化没有任何错误 -

URL service_endpoint;
service_endpoint = new URL(endpoint);
service = new UDHandlersServiceImpl(service_endpoint, SERVICE_QNAME).getUDHandlersServiceImplPort();

调用任何“service”方法后发生NullPointerException。它甚至没有到达服务器端 - 因为它没有任何日志。此外 - 这种情况只发生在WebSphere上 - 我们在Tomcat上部署了我们的客户端应用程序(服务器保留在websphere上)并且工作正常。还有一件事 - SoapUI也没有任何与服务器端交互的问题。

我们尝试将classLoadings切换为parentLast以用于客户端应用程序 - 但没有成功。

此外,我甚至找不到“org.apache.axis2.jaxws.message.databinding.JAXBUtils.getJAXBContext(JAXBUtils.java:445)”的来源。我google了它,并没有找到这个版本的JAXBUtils。但即使我这样做,我想,它也不会有用......

我希望有人能帮助我们解决这个不明显的问题。 先谢谢。

=====更新======

当我们从背书目录(或appServer / classes)中删除jaxb库时,问题似乎消失了,但是如果出现webExceptions(fault)服务器抛出

Caused by: java.lang.ClassCastException: com.ibm.xml.xlxp2.jaxb.JAXBContextImpl incompatible with com.sun.xml.bind.api.JAXBRIContext
at com.sun.xml.ws.fault.SOAPFaultBuilder.<clinit>(SOAPFaultBuilder.java:565)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:237)

并且不向客户返回任何答案。

1 个答案:

答案 0 :(得分:0)

我们已经意识到我们的例外情况并不包含3种必需的方法 -

//============required==================
public DocumentValidationException(String message, ErrorsBean errorsBean, Throwable cause) {
    super(message, cause);
    this.errorsBean = errorsBean;
}

public ErrorsBean getFaultInfo() {
    return errorsBean;
}

public DocumentValidationException(String message, ErrorsBean errorsBean) {
    super(message);
    this.errorsBean = errorsBean;
}
//======================================

所以,现在确实如此。

我们在@WebFault注释中也有一些错误的目标命名空间。 以下是具有类似问题的链接 - https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014076927#77777777-0000-0000-0000-000014083314