javax.xml.stream.XMLStreamException: Can not create StAX reader for the Source passed -- neither reader, input stream nor system id was accessible; can not use other types of sources (like embedded SAX streams)

Spring JIRA | Tareq Abedrabbo | 10 years ago
  1. 0

    I'm trying to create a javax.xml.stream.XMLStreamReader from WebServiceMessage.getPayloadSource(). I'm using Axiom to create web service messages and Woodstox as a StaX parser. The following code is throwing the following exception with Axiom but works fine with Saaj: javax.xml.stream.XMLStreamException: Can not create StAX reader for the Source passed -- neither reader, input stream nor system id was accessible; can not use other types of sources (like embedded SAX streams) XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader parser = inputFactory.createXMLStreamReader(message.getPayloadSource()); To reproduce the exception, modify the echo sample as follows: 1- Add Axiom jars to the classpath 2- Add Woodstox to the classpath 3- Add <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"/> to spring-ws-servlet.xml 4- Add the following endpoint interceptor: package org.springframework.ws.samples.echo.ws; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; import org.springframework.ws.WebServiceMessage; import org.springframework.ws.context.MessageContext; import org.springframework.ws.server.EndpointInterceptor; public class StaxEndpointInterceptor implements EndpointInterceptor { public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception { WebServiceMessage message = messageContext.getRequest(); XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader parser = inputFactory.createXMLStreamReader(message.getPayloadSource()); return true; } public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception { return true; } } 5 - configure it in spring-ws-servlet.xml: <bean id="staxEndpointInterceptor" class="org.springframework.ws.samples.echo.ws.StaxEndpointInterceptor"/> and <ref local="staxEndpointInterceptor"/> Calling echo now will throw the following exception: javax.xml.stream.XMLStreamException: Can not create StAX reader for the Source passed -- neither reader, input stream nor system id was accessible; can not use other types of sources (like embedded SAX streams) at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:756) at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:329) at org.springframework.ws.samples.echo.ws.StaxEndpointInterceptor.handleRequest(StaxEndpointInterceptor.java:16) at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:197) at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:166) at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handle(WebServiceMessageReceiverObjectSupport.java:78) at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:60) at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:125) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source)

    Spring JIRA | 10 years ago | Tareq Abedrabbo
    javax.xml.stream.XMLStreamException: Can not create StAX reader for the Source passed -- neither reader, input stream nor system id was accessible; can not use other types of sources (like embedded SAX streams)
  2. 0

    I'm trying to create a javax.xml.stream.XMLStreamReader from WebServiceMessage.getPayloadSource(). I'm using Axiom to create web service messages and Woodstox as a StaX parser. The following code is throwing the following exception with Axiom but works fine with Saaj: javax.xml.stream.XMLStreamException: Can not create StAX reader for the Source passed -- neither reader, input stream nor system id was accessible; can not use other types of sources (like embedded SAX streams) XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader parser = inputFactory.createXMLStreamReader(message.getPayloadSource()); To reproduce the exception, modify the echo sample as follows: 1- Add Axiom jars to the classpath 2- Add Woodstox to the classpath 3- Add <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"/> to spring-ws-servlet.xml 4- Add the following endpoint interceptor: package org.springframework.ws.samples.echo.ws; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; import org.springframework.ws.WebServiceMessage; import org.springframework.ws.context.MessageContext; import org.springframework.ws.server.EndpointInterceptor; public class StaxEndpointInterceptor implements EndpointInterceptor { public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception { WebServiceMessage message = messageContext.getRequest(); XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader parser = inputFactory.createXMLStreamReader(message.getPayloadSource()); return true; } public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception { return true; } } 5 - configure it in spring-ws-servlet.xml: <bean id="staxEndpointInterceptor" class="org.springframework.ws.samples.echo.ws.StaxEndpointInterceptor"/> and <ref local="staxEndpointInterceptor"/> Calling echo now will throw the following exception: javax.xml.stream.XMLStreamException: Can not create StAX reader for the Source passed -- neither reader, input stream nor system id was accessible; can not use other types of sources (like embedded SAX streams) at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:756) at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:329) at org.springframework.ws.samples.echo.ws.StaxEndpointInterceptor.handleRequest(StaxEndpointInterceptor.java:16) at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:197) at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:166) at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handle(WebServiceMessageReceiverObjectSupport.java:78) at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:60) at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:125) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source)

    Spring JIRA | 10 years ago | Tareq Abedrabbo
    javax.xml.stream.XMLStreamException: Can not create StAX reader for the Source passed -- neither reader, input stream nor system id was accessible; can not use other types of sources (like embedded SAX streams)
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Serialization in axis2

    Oracle Community | 8 years ago | 843833
    org.apache.axis2.AxisFault: Unknow type can not serialize
  5. 0

    [jira] Resolved: (WSCOMMONS-84) Cannot serialize SOAP message (java.lang.RuntimeException: Can not serialize OM Element Envelope)

    apache.org | 11 months ago
    java.lang.RuntimeException: Can not serialize OM Element Envelope

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.xml.stream.XMLStreamException

      Can not create StAX reader for the Source passed -- neither reader, input stream nor system id was accessible; can not use other types of sources (like embedded SAX streams)

      at com.ctc.wstx.stax.WstxInputFactory.createSR()
    2. Woodstox
      WstxInputFactory.createXMLStreamReader
      1. com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:756)
      2. com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:329)
      2 frames
    3. org.springframework.ws
      StaxEndpointInterceptor.handleRequest
      1. org.springframework.ws.samples.echo.ws.StaxEndpointInterceptor.handleRequest(StaxEndpointInterceptor.java:16)
      1 frame
    4. Spring WS Core
      MessageDispatcherServlet.doService
      1. org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:197)
      2. org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:166)
      3. org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handle(WebServiceMessageReceiverObjectSupport.java:78)
      4. org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:60)
      5. org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:125)
      5 frames
    5. Spring MVC
      FrameworkServlet.doPost
      1. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
      2. org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)
      2 frames
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      2 frames
    7. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      7. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      8. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      8 frames
    8. Grizzly HTTP
      LeaderFollowerWorkerThread.runIt
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      2. org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      3. org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      4. org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      4 frames
    9. Tomcat Util
      ThreadPool$ControlRunnable.run
      1. org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      1 frame
    10. Java RT
      Thread.run
      1. java.lang.Thread.run(Unknown Source)
      1 frame