WSO2 ESB 4.8.1 错误 publicId 和 systemId 之间需要空格

WSO2 ESB 4.8.1 ERROR White spaces are required between publicId and systemId

我们正在使用 WSO2 ESB 4.8.1 和 JAVA 1.7.0_55。总是,当我们启动 ESB 并发出第一个请求时,我们会收到此错误:

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.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.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

在此之后,我们提出相同的请求并且一切正常...

有什么建议可以避免这个错误吗?

分析带有此错误的响应,我们看到带有此消息的响应:

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

在调试源代码 ESB 之后,我们在 'synapse-nhttp-transport' class 中看到了一个错误,尽管文件 /repository/conf/axis2/axis2.xml 值包含在 'nonProxyHosts', 第一次调用总是通过代理发送。

代理本身就是切断流量的人,产生的错误是由它的响应引起的。

要修复已创建一个补丁,更改 class 保留如下:

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;
}

此外,已通知 WSO2 更正此错误。