Quantcast
Channel: Latest Questions on Splunk Answers
Viewing all articles
Browse latest Browse all 13053

Exception in thread "main" java.lang.RuntimeException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[26228,11] Message: XML

$
0
0

Hi,everyone. I'm new to Splunk.But now I meet a problem can't solve by myself. When I am going to store the data from splunk to a ArrayList,it occurs the following problem.

Exception in thread "main" java.lang.RuntimeException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[26228,11] Message: XML The document structure must be contained within the same entity from beginning to end。 at com.splunk.ResultsReaderXml.advanceStreamToNextSet(ResultsReaderXml.java:430) at com.splunk.ResultsReader.getNextElement(ResultsReader.java:105) at com.splunk.ResultsReader.getNextEvent(ResultsReader.java:66) at com.expedia.se.search.SplunkLogSearcher.search(SplunkLogSearcher.java:124) at com.expedia.app.App.main(App.java:57) Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[26228,11] Message: XML The document structure must be contained within the same entity from beginning to end。 at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598) at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(XMLEventReaderImpl.java:83) at com.splunk.ResultsReaderXml.readToStartOfElementWithName(ResultsReaderXml.java:224) at com.splunk.ResultsReaderXml.readIntoNextResultsElement(ResultsReaderXml.java:186) at com.splunk.ResultsReaderXml.advanceStreamToNextSet(ResultsReaderXml.java:428) ... 4 more

Here is my codes:

while (offset < resultCount) { CollectionArgs outputArgs = new CollectionArgs(); outputArgs.setCount(count); outputArgs.setOffset(offset);

        // Get the search results and display them
        InputStream results = job.getResults(outputArgs);
        ResultsReaderXml resultsReader = null;

        try {
            resultsReader = new ResultsReaderXml(results);

            HashMap<String, String> event;

            while ((event = resultsReader.getNextEvent()) != null) {
                System.out.println("\n***** RESULT " + x++ + " *****\n");
                for (String key : event.keySet())
                    System.out
                            .println("   " + key + ":  " + event.get(key));
                // insert to db
                events.add(event);
            }

            resultsReader.close();

            // Increase the offset to get the next set of results
            offset = offset + count;

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

I really need help, I will be highly appreciated if someone could help me, thank you!


Viewing all articles
Browse latest Browse all 13053

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>