Web Services 无法创建SOAP消息,因为出现异常:无法在com处创建StAX读取器或写入器,sun.xml.internal.ws.encoding.SOAPBindingCodec.decode

hc8w905p  于 2022-11-15  发布在  其他
关注(0)|答案(1)|浏览(517)

我的应用程序当前在生产环境中遇到以下错误。我的Java版本在生产环境中是Java版本“1.7.0_51”OpenJDK运行时环境(rhel-2.4.4.1.el6_5-x86_64 u 51-b 02)OpenJDK 64位服务器VM(build 24.45-b 08,混合模式)
有人能帮帮我吗?
错误为:

com.sun.xml.internal.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: Unable to create StAX reader or writer
    com.sun.xml.internal.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: Unable to create StAX reader or writer
            at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:348) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:254) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:203) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:163) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135) ~[na:1.7.0_51]
            at com.sun.proxy.$Proxy77.searchAssets(Unknown Source) ~[na:na]
            at com.ericsson.media.aggregator.client.MediaQueryWSClient.getAssetDetails(MediaQueryWSClient.java:76) ~[MediaQueryWSClient.class:na]
            at com.ericsson.media.aggregator.dao.MediaAggregatorDAO.callIndexerToBuildAssetMeta(MediaAggregatorDAO.java:393) [MediaAggregatorDAO.class:na]
            at com.ericsson.media.aggregator.dao.MediaAggregatorDAO.getlists(MediaAggregatorDAO.java:200) [MediaAggregatorDAO.class:na]
            at com.ericsson.media.aggregator.rest.MediaAggregatorService.getlists(MediaAggregatorService.java:68) [MediaAggregatorService.class:na]
            at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source) ~[na:na]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_51]
            at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_51]
            at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:255) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:209) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.2.1.GA.jar:na]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.2.1.GA.jar:na]
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) [servlet-api.jar:na]
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [catalina.jar:7.0.53]
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.53]
            at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat7-websocket.jar:7.0.53]
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.53]
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.53]
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.53]
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.53]
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [catalina.jar:7.0.53]
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) [catalina.jar:7.0.53]
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) [catalina.jar:7.0.53]
            at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) [catalina.jar:7.0.53]
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.53]
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) [catalina.jar:7.0.53]
            at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) [tomcat-coyote.jar:7.0.53]
            at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) [tomcat-coyote.jar:7.0.53]
            at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313) [tomcat-coyote.jar:7.0.53]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_51]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_51]
            at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]
    Caused by: com.sun.xml.internal.ws.streaming.XMLReaderException: Unable to create StAX reader or writer
            at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$Default.doCreate(XMLStreamReaderFactory.java:367) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.doCreate(XMLStreamReaderFactory.java:193) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:143) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:290) ~[na:1.7.0_51]
            at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) ~[na:1.7.0_51]
     at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:343) ~[na:1.7.0_51]
            ... 51 common frames omitted
    Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: JAXP00010001: The parser has encountered more than "64000" entity expansions in this document; this is the limit imposed by the JDK.
bksxznpy

bksxznpy1#

我收到了相同的错误消息:“”,因为我试图从javax.xml.transform.Source创建XMLStreamReader。然后我决定将Source对象转换为String,并从该对象创建InputStream。因此我使用了以下方法:

public String xmlNodeToString(Source source) throws Exception {
          StringWriter stringWriter=new StringWriter();
          Result result=new StreamResult(stringWriter);
          TransformerFactory factory=TransformerFactory.newInstance();
          Transformer transformer=factory.newTransformer();
          transformer.transform(source,result);
          return stringWriter.getBuffer().toString();
        }

然后我使用org.apache.commons.io.IOUtils从String创建一个输入流:

IOUtils.toInputStream(source2String,Charset.forName("ISO-8859-1"))

相关问题