skyscreamer / nevado

A JMS driver for Amazon SQS.
http://nevado.skyscreamer.org/
Apache License 2.0
51 stars 48 forks source link

JAXP00010001: The parser has encountered more than "64000" entity expansions in this document; this is the limit imposed by the JDK. #87

Open sjlacroix opened 10 years ago

sjlacroix commented 10 years ago

I keep getting this issue and seems to be related to the Amazon sdk version used:

Related Issues: ​https://github.com/aws/aws-sdk-java/issues/123 , https://github.com/yegor256/s3auth/issues/136

We are using this Java version:

java version "1.7.0_51" OpenJDK Runtime Environment (amzn-2.4.4.1.36.amzn1-x86_64 u51-b02) OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

Exception

014-07-06 20:19:55,841 [Thread-8] ERROR o.s.n.j.c.a.AmazonAwsSQSConnector.handleAWSException - Unable to retrieve message from queue https://sqs.us-east-1.amazonaws.com/**/: 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.) 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:708) ~[aws-java-sdk-1.6.12.jar:na] at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:392) ~[aws-java-sdk-1.6.12.jar:na] at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:228) ~[aws-java-sdk-1.6.12.jar:na] at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:1001) ~[aws-java-sdk-1.6.12.jar:na] at com.amazonaws.services.sqs.AmazonSQSClient.receiveMessage(AmazonSQSClient.java:706) ~[aws-java-sdk-1.6.12.jar:na] at org.skyscreamer.nevado.jms.connector.amazonaws.AmazonAwsSQSQueue.receiveMessage(AmazonAwsSQSQueue.java:102) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.connector.amazonaws.AmazonAwsSQSQueue.receiveMessage(AmazonAwsSQSQueue.java:19) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.connector.AbstractSQSConnector.receiveSQSMessage(AbstractSQSConnector.java:178) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.connector.AbstractSQSConnector.receiveMessage(AbstractSQSConnector.java:109) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.NevadoSession.getUnfilteredMessage(NevadoSession.java:471) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.NevadoSession.receiveMessage(NevadoSession.java:434) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.NevadoMessageConsumer.processAsyncMessage(NevadoMessageConsumer.java:133) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.AsyncConsumerRunner.processMessage(AsyncConsumerRunner.java:77) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.AsyncConsumerRunner.run(AsyncConsumerRunner.java:38) [nevado-jms-1.3.1.jar:1.3.1] at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51] 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) ~[na:1.7.0_51] at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.(XMLStreamReaderImpl.java:189) ~[na:1.7.0_51] at com.sun.xml.internal.stream.XMLInputFactoryImpl.getXMLStreamReaderImpl(XMLInputFactoryImpl.java:277) ~[na:1.7.0_51] at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:129) ~[na:1.7.0_51] at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLEventReader(XMLInputFactoryImpl.java:78) ~[na:1.7.0_51] at com.amazonaws.http.StaxResponseHandler.handle(StaxResponseHandler.java:89) ~[aws-java-sdk-1.6.12.jar:na] at com.amazonaws.http.StaxResponseHandler.handle(StaxResponseHandler.java:42) ~[aws-java-sdk-1.6.12.jar:na] at com.amazonaws.http.AmazonHttpClient.handleResponse(AmazonHttpClient.java:684) ~[aws-java-sdk-1.6.12.jar:na] ... 14 common frames omitted 2014-07-06 20:19:55,842 [Thread-8] ERROR o.s.n.j.AsyncConsumerRunner.processMessage - Unable to process message for consumer on PROD-Events javax.jms.JMSException: Unable to retrieve message from queue https://sqs.us-east-1.amazonaws.com/212921568335/PROD-Events: 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 org.skyscreamer.nevado.jms.connector.amazonaws.AmazonAwsSQSConnector.handleAWSException(AmazonAwsSQSConnector.java:268) ~[nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.connector.amazonaws.AmazonAwsSQSQueue.receiveMessage(AmazonAwsSQSQueue.java:106) ~[nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.connector.amazonaws.AmazonAwsSQSQueue.receiveMessage(AmazonAwsSQSQueue.java:19) ~[nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.connector.AbstractSQSConnector.receiveSQSMessage(AbstractSQSConnector.java:178) ~[nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.connector.AbstractSQSConnector.receiveMessage(AbstractSQSConnector.java:109) ~[nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.NevadoSession.getUnfilteredMessage(NevadoSession.java:471) ~[nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.NevadoSession.receiveMessage(NevadoSession.java:434) ~[nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.NevadoMessageConsumer.processAsyncMessage(NevadoMessageConsumer.java:133) ~[nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.AsyncConsumerRunner.processMessage(AsyncConsumerRunner.java:77) [nevado-jms-1.3.1.jar:1.3.1] at org.skyscreamer.nevado.jms.AsyncConsumerRunner.run(AsyncConsumerRunner.java:38) [nevado-jms-1.3.1.jar:1.3.1] at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51] 2014-07-06 20:19:55,842 [Thread-8] INFO o.s.j.l.SimpleMessageListenerContainer.onException - Trying to recover from JMS Connection exception: javax.jms.JMSException: Unable to retrieve message from queue https://sqs.us-east-1.amazonaws.com//***: 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.)

sjlacroix commented 10 years ago

This seemed to solve the problem, set the following custom JVM property. But is it just a temporary work around? jdk.xml.entityExpansionLimit = 0

frontierpsycho commented 10 years ago

According to the discussion on that other issue you posted, it is not a temporary workaround, but it does open your server up for DoS attacks, if the XML you parse comes from unreliable sources.