Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML 1.1 for sparql-results is incompatible with Jena clients #405

Closed
jimkont opened this issue May 12, 2015 · 8 comments
Closed

XML 1.1 for sparql-results is incompatible with Jena clients #405

jimkont opened this issue May 12, 2015 · 8 comments

Comments

@jimkont
Copy link

jimkont commented May 12, 2015

The following commit introduced problems with Jena clients (probably due to a xerces library bug).
b7bf790

The problems were reported by users of http://dbpedia.org but it will affect all VOS instanced updated to latest develop branch

An example using Jena that shows the problem is

sparql --data empty.ttl "SELECT * { SERVICE <http://dbpedia.org/sparql> { ?s ?p ?o } } LIMIT 1"

and produces this stack trace

Failed when initializing the StAX parsing engine
com.hp.hpl.jena.sparql.resultset.ResultSetException: Failed when initializing the StAX parsing engine
    at com.hp.hpl.jena.sparql.resultset.XMLInputStAX.<init>(XMLInputStAX.java:110)
    at com.hp.hpl.jena.sparql.resultset.XMLInput.make(XMLInput.java:81)
    at com.hp.hpl.jena.sparql.resultset.XMLInput.fromXML(XMLInput.java:39)
    at com.hp.hpl.jena.sparql.resultset.XMLInput.fromXML(XMLInput.java:34)
    at com.hp.hpl.jena.query.ResultSetFactory.fromXML(ResultSetFactory.java:309)
    at com.hp.hpl.jena.sparql.engine.http.Service.exec(Service.java:191)
    at com.hp.hpl.jena.sparql.engine.main.iterator.QueryIterService.nextStage(QueryIterService.java:56)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:110)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:67)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIterSlice.hasNextBinding(QueryIterSlice.java:76)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
    at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
    at com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:75)
    at com.hp.hpl.jena.sparql.engine.ResultSetCheckCondition.hasNext(ResultSetCheckCondition.java:59)
    at com.hp.hpl.jena.sparql.resultset.ResultSetMem.<init>(ResultSetMem.java:97)
    at com.hp.hpl.jena.query.ResultSetFactory.makeRewindable(ResultSetFactory.java:419)
    at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:149)
    at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:132)
    at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:120)
    at com.hp.hpl.jena.sparql.resultset.TextOutput.format(TextOutput.java:65)
    at com.hp.hpl.jena.query.ResultSetFormatter.out(ResultSetFormatter.java:166)
    at com.hp.hpl.jena.sparql.util.QueryExecUtils.outputResultSet(QueryExecUtils.java:160)
    at com.hp.hpl.jena.sparql.util.QueryExecUtils.doSelectQuery(QueryExecUtils.java:199)
    at com.hp.hpl.jena.sparql.util.QueryExecUtils.executeQuery(QueryExecUtils.java:80)
    at arq.query.queryExec(query.java:208)
    at arq.query.exec(query.java:159)
    at arq.cmdline.CmdMain.mainMethod(CmdMain.java:102)
    at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
    at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
    at arq.sparql.main(sparql.java:28)
Caused by: java.lang.NullPointerException
    at com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl.scanStartElement(XML11NSDocumentScannerImpl.java:356)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl.next(XML11NSDocumentScannerImpl.java:857)
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:558)
    at com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.processHead(XMLInputStAX.java:379)
    at com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.init(XMLInputStAX.java:195)
    at com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.<init>(XMLInputStAX.java:187)
    at com.hp.hpl.jena.sparql.resultset.XMLInputStAX.worker(XMLInputStAX.java:147)
    at com.hp.hpl.jena.sparql.resultset.XMLInputStAX.<init>(XMLInputStAX.java:106)
    ... 33 more
@jimkont jimkont changed the title revert to xml 1.0 for sparql-results XML 1.1 for sparql-results is incompatible with Jena clients May 12, 2015
@HughWilliams
Copy link
Collaborator

@jimkont: So, Jena (or its parser engine) does not support results in XML 1.1 format ?

Is there a simple test case for recreating this behaviour ?

@jimkont
Copy link
Author

jimkont commented May 12, 2015

This is probably a bug in the xml parsing library Jena that is using (Xerces).
If you install Jena locally from https://jena.apache.org/documentation/tools/
and run the following commands you will get the error stack trace described above:

touch empty.ttl # just an empty turtle
sparql --data empty.ttl "SELECT * { SERVICE <http://dbpedia.org/sparql> { ?s ?p ?o } } LIMIT 1"

Unless this is important, I suggest you revert this commit back until a fix is made in Jena.
Jena is a very common client so this will probably bring many complaints in the future

@HughWilliams
Copy link
Collaborator

@jimkont: OK, i have been able to recreate and reported to development to look into ...

@HughWilliams
Copy link
Collaborator

@jimkont: The commit has been reverted:

http://sourceforge.net/p/virtuoso/virtuoso-opensource/ci/f1cf34ad3dec2bf1db53a29c311d1b2a2662b994

The dbpedia binary will soon be updated with this update ...

@jimkont
Copy link
Author

jimkont commented May 15, 2015

Noticed that already! Thanks a lot @HughWilliams

@jimkont jimkont closed this as completed May 15, 2015
@pfps
Copy link

pfps commented Jun 24, 2015

So I, who have been waiting for this fix since last September, have to wait longer because of other buggy software? Surely the right way to do this was to get the Xerxes software fixed.

@dwvisser
Copy link

Has anybody filed a bug report with the Xerces project? (Or alternatively, could someone share the appropriate issue tracker here?)

@pfps
Copy link

pfps commented Jun 24, 2015

On further examination, it appears that it may not be a current Xerces bug.

A comment in b7bf790 indicates that the problem is with "the standard OpenJDK XML parser" which is apparently based on Xerces 2.7.

There are workarounds given at https://issues.apache.org/jira/browse/JENA-942.

So, what should be done? Something is pulling in an old buggy XML parser. This appears to be either Jena or OpenJDK.

I'm finding it astonishing that progress is being blocked today because there is still software that does not correctly handle XML 1.1, which came out in 2006. I think that the best way forward is to produce a method for not using the offending software and then tell people who are using it to use the new method Software that can't handle XML 1.1 should be put in the ash can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants