WSO2 ESB 4.8.1 ERROR White spaces are required bet

2020-02-15 02:14发布

问题:

We are working with WSO2 ESB 4.8.1 with JAVA 1.7.0_55. Always, when we start the ESB and make the first request we receive this error:

TID: [0] [ESB] [2015-04-22 10:51:31,067] ERROR {org.apache.synapse.transport.passthru.util.RelayUtils} -  Error while building Passthrough stream {org.apache.synapse.transport.passthru.util.RelayUtils}
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,62]
Message: White spaces are required between publicId and systemId.
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
                at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
                at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:129)
                at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:107)
                at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:82)
                at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:68)
                at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
                at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
                at org.apache.synapse.rest.Resource.process(Resource.java:297)
                at org.apache.synapse.rest.API.process(API.java:298)
                at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
                at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:50)
                at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
                at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)
                at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
                at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
                at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
                at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,62]
Message: White spaces are required between publicId and systemId.
                at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598)
                at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
                at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
                at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
                at org.apache.axiom.util.stax.dialect.SJSXPStreamReaderWrapper.next(SJSXPStreamReaderWrapper.java:138)
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
                ... 22 more
TID: [0] [ESB] [2015-04-22 10:51:31,073] ERROR {org.apache.synapse.mediators.base.SequenceMediator} -  Error while building message {org.apache.synapse.mediators.base.SequenceMediator}
org.apache.axis2.AxisFault: Error while building Passthrough stream
                at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:236)
                at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:111)
                at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:82)
                at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:68)
                at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
                at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
                at org.apache.synapse.rest.Resource.process(Resource.java:297)
                at org.apache.synapse.rest.API.process(API.java:298)
                at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
                at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:50)
                at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
                at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)
                at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
                at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
                at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
                at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,62]
Message: White spaces are required between publicId and systemId.
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
                at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
                at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:129)
                at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:107)
                ... 17 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,62]
Message: White spaces are required between publicId and systemId.
                at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598)
                at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
                at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
                at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
                at org.apache.axiom.util.stax.dialect.SJSXPStreamReaderWrapper.next(SJSXPStreamReaderWrapper.java:138)
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
                at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
                ... 22 more

After this, we make same request and all works fine...

Any suggestion in order to avoid this error?

回答1:

Analyzing response with this error we saw responses with this message:

"Error Code: 502 Proxy Error. The ISA Server denied the specified Uniform Resource Locator (URL).

After debug source code ESB we saw in the 'synapse-nhttp-transport' class there was a bug where, although the file /repository/conf/axis2/axis2.xml values contained in the 'nonProxyHosts', first call is always sent through the proxy.

The proxy itself was the one who cut the traffic and error produced was motivated by the response from it.

To fix has created a patch changing the class leaving it as follows:

public HttpHost selectProxy(final HttpHost target) {
  if (this.proxy != null) {
    if (knownProxyHosts.contains(target.getHostName().toLowerCase(Locale.US))) {
      return this.proxy;
    } else if (knownProxyHosts.contains(target,getHostName().toLowerCase(Locale.US))) {
      return null;
    } else {
      // we are encountering this host for the first time
      if (!isByPass(target.getHostName().toLowerCase(Locale.US))) {
        return this.proxy;
      } else {
        return null;
      }   
    }
  }
  return this.proxy;
}

Additionally, WSO2 has been notified to correct this bug.