作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是一个远景,但我正在尝试使用 Spring-WS 编写一个 Web 服务客户端。我收到一个 NullPointerException
,代码如下:
public class WebServiceProcess {
private WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
private CommonsHttpMessageSender messageSender = new CommonsHttpMessageSender();
private SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory();
private Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
private void init() {
Resource schema = new ClassPathResource("/WEB-INF/mySchema.xsd");
marshaller.setSchema(schema);
marshaller.setContextPaths("list of packages with JAXB classes...");
webServiceTemplate.setMarshaller(marshaller);
webServiceTemplate.setUnmarshaller(marshaller);
webServiceTemplate.setMessageSender(messageSender);
}
public TestResponse sendRequest(TestRequest request) {
init();
return response = (TestResponse) webServiceTemplate.marshalSendAndReceive("myEndpointURI", request);
}
}
堆栈跟踪:
Exception in thread "main" java.lang.NullPointerException
at com.ibm.ws.webservices.engine.utils.WebServicesParserFactory.setNamespaceAware(WebServicesParserFactory.java:160)
at com.ibm.ws.webservices.engine.utils.XMLUtils.initSAXFactory(XMLUtils.java:437)
at com.ibm.ws.webservices.engine.utils.XMLUtils.getSAXParser(XMLUtils.java:490)
at com.ibm.ws.webservices.engine.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:293)
at com.ibm.ws.webservices.engine.SOAPPart._getSOAPEnvelope(SOAPPart.java:1064)
at com.ibm.ws.webservices.engine.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:628)
at com.ibm.ws.webservices.engine.SOAPPart.getEnvelope(SOAPPart.java:656)
at org.springframework.ws.soap.saaj.support.SaajUtils.getSaajVersion(SaajUtils.java:155)
at org.springframework.ws.soap.saaj.SaajSoapMessage.getSaajVersion(SaajSoapMessage.java:257)
at org.springframework.ws.soap.saaj.SaajSoapMessage.getImplementation(SaajSoapMessage.java:342)
at org.springframework.ws.soap.saaj.SaajSoapMessage.<init>(SaajSoapMessage.java:117)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:184)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:58)
at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:90)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:548)
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:496)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:343)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:333)
at com.lmig.processing.WebServiceProcess.sendRequest(WebServiceProcess.java:66)
at com.lmig.processing.TestProcess.main(MainProcess.java:57)
任何帮助将不胜感激....我知道我没有太多事情要做。谢谢。
最佳答案
解决了。我的类路径中有错误的 WebSphere jar。我有 com.ibm.ws.admin.client_7.0.0.jar 而不是 com.ibm.ws.webservices.thinclient_7.0.0.jar。
关于java - Spring-WS:尝试使用 WebServicesParserFactory 设置 NameSpaceAware 时出现 NullPointerException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7761868/
我正在尝试对 Maven 使用的“正确”pom.xml 执行一些检索查询。为此,我使用来自 JDOM 的基本 XPath 查询。 不幸的是,查询不返回任何结果(简单的后代过滤器也不返回任何结果)。我有
这是一个远景,但我正在尝试使用 Spring-WS 编写一个 Web 服务客户端。我收到一个 NullPointerException,代码如下: public class WebServicePro
我是一名优秀的程序员,十分优秀!