• tomcat提供的xfire接口,访问报错javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: JAXP00010001: 解析器在此文档中遇到多个 "200000" 实体扩展; 这是 JDK 施加的限制


    服务商做好的服务,使用tomcat提供的webservice服务,我们去访问时过段时间就会报错。

    这是我把后台日志报错信息,粘贴保存为一个html后打开的效果。

    之前那个200000是37000,经常报错,然后同时调整为了200000,撑的时间长一点,出现异常时就重启一下。

    服务商说是我们访问时没有断开连接,我检查了我们本地代码,没什么问题,百度了xfire的访问,也没说要断开连接的。

    这是stackover上一个比较相似的错误   https://stackoverflow.com/questions/20482331/whats-causing-these-parseerror-exceptions-when-reading-off-an-aws-sqs-queue-in

    翻译:

    在我的风暴集群中读取AWS SQS队列时,是什么导致了这些ParseError异常?

      我正在使用Storm0.8.1从AmazonSQS队列中读取传入消息,并在执行此操作时获得一致的异常:

    2013-12-02 02:21:38 executor [ERROR] 
    java.lang.RuntimeException: com.amazonaws.AmazonClientException: Unable to unmarshall response (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.)
            at REDACTED.spouts.SqsQueueSpout.handleNextTuple(SqsQueueSpout.java:219)
            at REDACTED.spouts.SqsQueueSpout.nextTuple(SqsQueueSpout.java:88)
            at backtype.storm.daemon.executor$fn__3976$fn__4017$fn__4018.invoke(executor.clj:447)
            at backtype.storm.util$async_loop$fn__465.invoke(util.clj:377)
            at clojure.lang.AFn.run(AFn.java:24)
            at java.lang.Thread.run(Thread.java:701)
    Caused by: com.amazonaws.AmazonClientException: Unable to unmarshall response (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.)
            at com.amazonaws.http.AmazonHttpClient.handleResponse(AmazonHttpClient.java:524)
            at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:298)
            at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:167)
            at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:812)
            at com.amazonaws.services.sqs.AmazonSQSClient.receiveMessage(AmazonSQSClient.java:575)
            at REDACTED.spouts.SqsQueueSpout.handleNextTuple(SqsQueueSpout.java:191)
            ... 5 more
    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.
            at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.setInputSource(XMLStreamReaderImpl.java:219)
            at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.<init>(XMLStreamReaderImpl.java:189)
            at com.sun.xml.internal.stream.XMLInputFactoryImpl.getXMLStreamReaderImpl(XMLInputFactoryImpl.java:277)
            at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:129)
            at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLEventReader(XMLInputFactoryImpl.java:78)
            at com.amazonaws.http.StaxResponseHandler.handle(StaxResponseHandler.java:85)
            at com.amazonaws.http.StaxResponseHandler.handle(StaxResponseHandler.java:41)
            at com.amazonaws.http.AmazonHttpClient.handleResponse(AmazonHttpClient.java:503)
            ... 10 more

    我已经调试了队列中的数据,一切看起来都很好。我不明白API的XML响应为什么会导致这些问题。有什么想法吗?

    回答:

      多年来一直在回答我自己的问题。 

      目前在Oracle和OpenJDK的Java中有一个XML扩展限制处理错误,导致共享计数器在解析多个XML文档时会碰到默认上限。 

      https://blogs.oracle.com/joew/entry/jdk_7u45_aws_issue_123

      https://bugs.openjdk.java.net/browse/jdk-8028111

      https://github.com/aws/aws-sdk-java/issues/123

      虽然我认为我们的版本(6B27-1.12.6-1ubuntu0.12.04.4)没有受到影响,但是运行OpenJDK bug报告中给出的示例代码确实验证了我们对该bug的敏感性。 

      为了解决这个问题,我需要将jdk.xml.EntityExpansionLimit=0传递给Storm Workers。通过在集群的storm.yaml中添加以下内容,我可以缓解这个问题。 

      supervisor.childopts:“-djdk.xml.entityExpansionLimit=0”

      worker.childopts:“-djdk.xml.entityExpansionLimit=0”

      我应该注意到,从技术上讲,这会使您面临拒绝服务攻击,但是由于我们的XML文档只来自于SQS,所以我不担心有人伪造恶意的XML来杀死我们的工作人员。

      可能还有更多。我在使用Java6时也遇到同样的错误。我的机器上没有安装Java7。

      不要介意。发现这也会影响Java5、6、7和8的特定版本。详情请参见:bugs.openjdk.java.net/browse/jdk-8028111–brianc mar 19'14,15:00

      大家好,我只需在程序中添加“system.setproperty”(“jdk.xml.entityExpansionLimit”,“0”)一行就解决了这个问题。奇怪的是,当使用从命令行传递给程序的参数作为参数时,问题仍然存在。

      根据Java文档,将“JDK.XML.EntEngestExpCurimeLim限度”属性设置为“0”并没有限制。应使用负值禁用实体扩展。docs.oracle.com/javase/tutorial/jaxp/limits/limits.html

    ---------------end------------------------

    后续,等待与机构商沟通,有解决办法了再更新

  • 相关阅读:
    js写的ajax
    String根据、拆分
    Excel数据批量导入到数据库2
    Excel数据批量导入到数据库
    List去重复(不是最简单,但绝对是最易理解)
    struts中Cookie实现记住密码
    ==与equals的区别
    javascript实现登录验证码
    Javascript实现二级select联动
    javascript的假查询
  • 原文地址:https://www.cnblogs.com/xinzhisoft/p/10571682.html
Copyright © 2020-2023  润新知