[SWS-335]  SaajXmlReader NullPointerException / jboss / mac in interceptors Created: 17/Apr/08  Updated: 05/May/08  Resolved: 27/Apr/08

Status: Closed
Project: Spring Web Services
Component/s: None
Affects Version/s: 1.5
Fix Version/s: 1.5.1

Type: Bug Priority: Blocker
Reporter: Jacques Couzteau Assignee: Arjen Poutsma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac OSX 10.5.2 / JBoss 4.2.2 / Java 1.5



 Description   

run my app in the jboss environment (JBoss 4.2.2GA) I always fail with nullpointer exceptions in one of my payload interceptors (PayloadLoggingInterceptor, PayloadValidatingInterceptor).
When I have validation turned on, I fail in xerces, if it's off I fail the logger in xalan.

See stacktraces, failure in validator:
Code:

java.lang.NullPointerException
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleText(SaajXmlReader.java:187)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:127)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:150)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:123)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:150)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:123)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:150)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:123)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.parse(SaajXmlReader.java:115)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.parse(SaajXmlReader.java:96)
at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source)
at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
at javax.xml.validation.Validator.validate(Unknown Source)
at org.springframework.xml.validation.Jaxp13ValidatorFactory$Jaxp13Validator.validate(Jaxp13ValidatorFactory.java:61)
at org.springframework.ws.server.endpoint.interceptor.AbstractValidatingInterceptor.handleResponse(AbstractValidatingInterceptor.java:185)
at org.springframework.ws.server.MessageDispatcher.triggerHandleResponse(MessageDispatcher.java:341)
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:218)
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:162)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:87)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:197)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)

failure in logger:
Code:

14:57:46,159 INFO [STDOUT] 2008-04-07 14:57:46,158 WARN [org.springframework.ws.soap.server.SoapMessageDispatcher] - Endpoint invocation resulted in exception - responding with SOAP Fault
java.lang.NullPointerException
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleText(SaajXmlReader.java:187)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:127)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:150)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:123)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:150)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:123)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:150)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:123)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.parse(SaajXmlReader.java:115)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.parse(SaajXmlReader.java:96)
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
at org.springframework.ws.server.endpoint.1.logMessageSource(AbstractLoggingInterceptor.java:102)
at org.springframework.ws.server.endpoint.AbstractLoggingInterceptor.handleResponse(AbstractLoggingInterceptor.java:81)
at org.springframework.ws.server.MessageDispatcher.triggerHandleResponse(MessageDispatcher.java:341)
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:218)
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:162)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:87)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:197)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at ... snip

my bean looks like this,
Code:

<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<property name="interceptors">
<list>
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
<bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<property name="schema" value="/WEB-INF/xsd/codexws.xsd"/>
<property name="validateRequest" value="true"/>
<property name="validateResponse" value="true"/>
</bean>
</list>
</property>
<property name="order" value="1"/>
</bean>

I have explicitly defined the message factory:
Code:

<bean id="messageFactory"
class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<description>
define default message factory to avoid problems with JBoss'
built in factory. See http://static.springframework.org/spring-ws/site/faq.html#saaj-jboss
</description>
<property name="messageFactory">
<bean
class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl">
</bean>
</property>
</bean>



 Comments   
Comment by Arjen Poutsma [ 17/Apr/08 ]

I'm looking at line 187 of SaajXmlReader, but I honestly can see anything that can cause a NPE. Are you sure you're running Spring-WS 1.5.0?

Comment by Jacques Couzteau [ 19/Apr/08 ]

The stack trace was probaly not 1.5, but I cn repro with 1.5: Here is the stacktrace, crashes in 171 now:

18:49:31,501 INFO [STDOUT] 2008-04-19 18:49:31,500 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Endpoint invocation resulted in exception - responding with Fault
java.lang.NullPointerException
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleText(SaajXmlReader.java:171)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:129)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:152)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:125)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:152)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:125)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:152)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:125)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleElement(SaajXmlReader.java:152)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.handleNode(SaajXmlReader.java:125)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.parse(SaajXmlReader.java:117)
at org.springframework.ws.soap.saaj.support.SaajXmlReader.parse(SaajXmlReader.java:98)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.process(ValidatorImpl.java:192)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:147)

Comment by Arjen Poutsma [ 27/Apr/08 ]

Fixed in SVN.

The mystery that remains is that the SaajXmlReader is only supposed to be used under SAAJ 1.1 (See Saaj11Implementation), but the MessageFactory implementation you configure (SOAPMessageFactory1_1Impl) indicates at least SAAJ 1.2. This might be due to having a SAAJ 1.1 API jar on the classpath somewhere.

Comment by Jacques Couzteau [ 29/Apr/08 ]

thanks Arjen.

Comment by Arjen Poutsma [ 05/May/08 ]

Closing issues for 1.5.1

Generated at Mon Dec 18 07:08:00 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.