org.springframework.dao.DataAccessResourceFailureException: Error while reading from event reader; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[8,2] Message: Element type "thing" must be followed by either attribute specifications, ">" or "/>".

Spring JIRA | drekbour | 7 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Scenario MRIR with a StaxEventItemReader as the delegate and several resources to loop through. Simplest failure scenario is if one of the XML files is truncated. A call to MRIR.read() gets the following exception: org.springframework.dao.DataAccessResourceFailureException: Error while reading from event reader; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[8,2] Message: Element type "thing" must be followed by either attribute specifications, ">" or "/>". at org.springframework.batch.item.xml.StaxEventItemReader.moveCursorToNextFragment(OXMStaxEventItemReader.java:198) at org.springframework.batch.item.xml.StaxEventItemReader.doRead(OXMStaxEventItemReader.java:336) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:85) at org.springframework.batch.item.file.MultiResourceItemReader.readNextItem(MultiResourceItemReader.java:111) at org.springframework.batch.item.file.MultiResourceItemReader.read(MultiResourceItemReader.java:99) Without any particular handling of the scenario, MRIR treats this as an item-specific problem and will keep retrying to reaD() the delegate without ever giving up. DataAccessResourceException javadoc : "Data access exception thrown when a resource fails completely: for example, if we can't connect to a database using JDBC." A) MRIR should recognise the resource has failed completely and "jump" to the next on the next call to read(). B) I'm not sure what exception to base this behaviour upon because the Exception inheritance is topsy-turvy. The generated exception is actually a child of NonTransientDataAccessResourceException (though the classname hints that it is more specific) with identical javadoc "Data access exception thrown when a resource fails completely and the failure is permanent." I'll be attaching a proposed patch for handling of this.

    Spring JIRA | 7 years ago | drekbour
    org.springframework.dao.DataAccessResourceFailureException: Error while reading from event reader; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[8,2] Message: Element type "thing" must be followed by either attribute specifications, ">" or "/>".
  2. 0

    Scenario MRIR with a StaxEventItemReader as the delegate and several resources to loop through. Simplest failure scenario is if one of the XML files is truncated. A call to MRIR.read() gets the following exception: org.springframework.dao.DataAccessResourceFailureException: Error while reading from event reader; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[8,2] Message: Element type "thing" must be followed by either attribute specifications, ">" or "/>". at org.springframework.batch.item.xml.StaxEventItemReader.moveCursorToNextFragment(OXMStaxEventItemReader.java:198) at org.springframework.batch.item.xml.StaxEventItemReader.doRead(OXMStaxEventItemReader.java:336) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:85) at org.springframework.batch.item.file.MultiResourceItemReader.readNextItem(MultiResourceItemReader.java:111) at org.springframework.batch.item.file.MultiResourceItemReader.read(MultiResourceItemReader.java:99) Without any particular handling of the scenario, MRIR treats this as an item-specific problem and will keep retrying to reaD() the delegate without ever giving up. DataAccessResourceException javadoc : "Data access exception thrown when a resource fails completely: for example, if we can't connect to a database using JDBC." A) MRIR should recognise the resource has failed completely and "jump" to the next on the next call to read(). B) I'm not sure what exception to base this behaviour upon because the Exception inheritance is topsy-turvy. The generated exception is actually a child of NonTransientDataAccessResourceException (though the classname hints that it is more specific) with identical javadoc "Data access exception thrown when a resource fails completely and the failure is permanent." I'll be attaching a proposed patch for handling of this.

    Spring JIRA | 7 years ago | drekbour
    org.springframework.dao.DataAccessResourceFailureException: Error while reading from event reader; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[8,2] Message: Element type "thing" must be followed by either attribute specifications, ">" or "/>".

    Root Cause Analysis

    1. org.springframework.dao.DataAccessResourceFailureException

      Error while reading from event reader; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[8,2] Message: Element type "thing" must be followed by either attribute specifications, ">" or "/>".

      at org.springframework.batch.item.xml.StaxEventItemReader.moveCursorToNextFragment()
    2. Spring Batch Infrastructure
      MultiResourceItemReader.read
      1. org.springframework.batch.item.xml.StaxEventItemReader.moveCursorToNextFragment(OXMStaxEventItemReader.java:198)
      2. org.springframework.batch.item.xml.StaxEventItemReader.doRead(OXMStaxEventItemReader.java:336)
      3. org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:85)
      4. org.springframework.batch.item.file.MultiResourceItemReader.readNextItem(MultiResourceItemReader.java:111)
      5. org.springframework.batch.item.file.MultiResourceItemReader.read(MultiResourceItemReader.java:99)
      5 frames