Announcement Announcement Module
No announcement yet.
XMLStreamException : Message: Content is not allowed in prolog Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • XMLStreamException : Message: Content is not allowed in prolog


    I have a problem when i want to read xml file on UTF8 with StaxEventItemReader on unix environment. This is my log:

    Caused by: org.springframework.dao.DataAccessResourceFailureE xception: Error while reading from event reader; nested exception is ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
    at org.springframework.batch.item.xml.StaxEventItemRe ader.moveCursorToNextFragment(StaxEventItemReader. java:160)
    at org.springframework.batch.item.xml.StaxEventItemRe ader.doRead(
    at org.springframework.batch.core.step.item.SimpleChu nkProvider.doRead(
    at org.springframework.batch.core.step.item.FaultTole java:68)
    ... 27 more

    At first time, i thought it's on my xml file.

    Maybe there is a Byte Order Mark at the beginning xml file but not. I used the command line to delete BOM:
    awk '{if(NR==1)sub(/^\xef\xbb\xbf/,"");print}' INFILE > OUTFILE
    and i have the same error.

    On eclipse environment, it's worked.

    I don't have any idea. Can you help me

  • #2
    It sounds like you have some unwanted characters (most probably the BOM) in your xml file. To verify this, I suggest you manually create a simple XML file that resembles your actual input. Then use your reader to read the new XML file.