Closed mmisw closed 9 years ago
From caru...@gmail.com on June 30, 2010 00:00:55
The ORR portal now uses the latest version of Jena (2.6.3). As expected, this fixes this error. The accept header sent by Jena is now: application/rdf+xml, application/xml; q = 0.8, text/xml; q = 0.7, application/rss+xml; q = 0.3, /; q = 0.2
This is fixed in: MMI Portal 1.9.8.alpha (20100629235638)
(NOTE: I updated all MMISW modules (Ont, iserver, and ORR) to use Jena 2.6.3)
Status: Fixed
Labels: -ont portal
From caru...@gmail.com on June 29, 2010 17:18:36
What steps will reproduce the problem? 1. have some ontology in edit mode so you can trigger the selection of resource types, for example
dummy: White spaces are required between publicId and systemId What is the expected output? The correct list of options from the RDF contents of the corresponding resource. What do you see instead? The strings mentioned above.
The stacktrace logged in orr.log is:
2010-06-29 16:45:59,701 DEBUG [org.mmisw.iserver.core.MdUtil] - reading: http://mmisw.org/ont/mmi/resourcetype/ResourceType individuals to populate ResourceType list 2010-06-29 16:46:02,540 ERROR [com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler] - http://mmisw.org/ont/mmi/resourcetype(line 1 column 63): White spaces are required between publicId and systemId. 2010-06-29 16:46:02,540 DEBUG [org.mmisw.iserver.core.MdUtil] - Error trying to read: http://mmisw.org/ont/mmi/resourcetype/ResourceType : rethrew: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId. org.xml.sax.SAXParseException: White spaces are required between publicId and systemId. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ... at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse(RDFXMLParser.java:106) at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:215) at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:202) at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:272) at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:225) at com.hp.hpl.jena.ontology.impl.OntModelImpl.read(OntModelImpl.java:2169) at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:210) at com.hp.hpl.jena.ontology.impl.OntModelImpl.read(OntModelImpl.java:2130) at com.hp.hpl.jena.ontology.impl.OntModelImpl.read(OntModelImpl.java:2100) at com.hp.hpl.jena.ontology.impl.OntModelImpl.read(OntModelImpl.java:2061) at org.mmisw.iserver.core.MdUtil.populateList(MdUtil.java:85) at org.mmisw.iserver.core.MdUtil.readResourceTypes(MdUtil.java:58) at org.mmisw.iserver.core.MdHelper.refreshOptions(MdHelper.java:509) at org.mmisw.ontmd.gwt.server.OntMdServiceImpl.refreshOptions(OntMdServiceImpl.java:202)
NOTE that http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/model/Model.html#read%28java.lang.String%29 says:
Model read(java.lang.String url)
however, apparently the claimed "content negotiation" is incorrect as the following fragment from the ont.log file shows:
2010-06-29 16:45:59,713 DEBUG [org.mmisw.ont.OntServlet] - Not explicit output format given (either file extension or form parameter). Using [html] by content negotiation. 2010-06-29 16:45:59,714 DEBUG [org.mmisw.ont.OntServlet] - __Request: fullRequestedUri: http://mmisw.org/ont/mmi/resourcetype 2010-06-29 16:45:59,715 DEBUG [org.mmisw.ont.OntServlet] - Params: {} 2010-06-29 16:45:59,715 DEBUG [org.mmisw.ont.OntServlet] - user-agent: [Java/1.5.019] 2010-06-29 16:45:59,715 DEBUG [org.mmisw.ont.OntServlet] - PC-Remote-Addr: [134.89.2.23] 2010-06-29 16:45:59,715 DEBUG [org.mmisw.ont.OntServlet] - Accept entries: [text/html, image/gif, image/jpeg, ; q = 0.2, */_; q = 0.2] 2010-06-29 16:45:59,715 DEBUG [org.mmisw.ont.OntServlet] - Dominating entry: "text/html" 2010-06-29 16:45:59,716 DEBUG [org.mmisw.ont.OntServlet] - mmiUri: http://mmisw.org/ont/mmi/resourcetype 2010-06-29 16:45:59,716 DEBUG [org.mmisw.ont.OntServlet] - outFormat: html 2010-06-29 16:45:59,716 DEBUG [org.mmisw.ont.OntServlet] - version: null
In particular, note that Jena sends the accept header: text/html, image/gif, image/jpeg, ; q = 0.2, */; q = 0.2
instead of having "application/rdf+xml" as a first option. This is known bug, see http://sourceforge.net/tracker/?func=detail&atid=430288&aid=1424091&group_id=40417 , which seems to have been fixed in a newer Jena version. I's still using 2.5.6:
$ java -cp WebContent/WEB-INF/lib/jena.jar jena.version PATH: com.hp.hpl.jena NAME: Jena WEBSITE: http://jena.sourceforge.net/ VERSION: 2.5.6 MAJOR_VERSION: 2 MINOR_VERSION: 5.6 VERSION_STATUS: BUILD_DATE: 11-June-2008 15:56
Solution:
I will test a newer version of Jena confirming that it has solved the bug.
If not, instead of the workaround described in the sourceforge comment above (which is not complete as it does not handle 'imports' for example), I will implement a special handling in Ont such that a user-agent like the following [Java/1.5.0_19], ie., starting with "Java/" will give preference to "application/rdf+xml" (I think I already have something like this somewhere in the code).
Original issue: http://code.google.com/p/mmisw/issues/detail?id=259