Andy,

Thanks! I opened a JIRA ticket (https://issues.apache.org/jira/browse/JENA-1037), and will keep an eye on it. In the mean time, I'll look into why RIOT isn't intercepting the method call. I do see that the Apache Jena - OSGi bundle isn't requiring the xerces library... Which seems strange (unless it packaged it in the bundle itself?).

karaf@root()> requirements 146
org.apache.jena.osgi [146] requires:
------------------------------------
osgi.wiring.package; (osgi.wiring.package=sun.misc) resolved by:
   osgi.wiring.package; sun.misc 0.0.0 from org.apache.felix.framework [0]
osgi.wiring.package; (&(osgi.wiring.package=com.fasterxml.jackson.core)(version>=2.3.0)(!(version>=3.0.0))) resolved by: osgi.wiring.package; com.fasterxml.jackson.core 2.6.2 from com.fasterxml.jackson.core.jackson-core [128] osgi.wiring.package; (&(osgi.wiring.package=com.fasterxml.jackson.databind)(version>=2.3.0)(!(version>=3.0.0))) resolved by: osgi.wiring.package; com.fasterxml.jackson.databind 2.6.2 from com.fasterxml.jackson.core.jackson-databind [130] osgi.wiring.package; (osgi.wiring.package=com.github.jsonldjava.core) resolved by: osgi.wiring.package; com.github.jsonldjava.core 0.6.0 from com.github.jsonld-java [134] osgi.wiring.package; (osgi.wiring.package=com.github.jsonldjava.utils) resolved by: osgi.wiring.package; com.github.jsonldjava.utils 0.6.0 from com.github.jsonld-java [134]
osgi.wiring.package; (osgi.wiring.package=javax.annotation) resolved by:
osgi.wiring.package; javax.annotation 1.2.0 from org.apache.felix.framework [0]
osgi.wiring.package; (osgi.wiring.package=javax.management) resolved by:
osgi.wiring.package; javax.management 0.0.0 from org.apache.felix.framework [0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.cli)(version>=1.3.0)(!(version>=2.0.0))) resolved by: osgi.wiring.package; org.apache.commons.cli 1.3.1 from org.apache.commons.cli [131] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.csv)(version>=1.0.0)(!(version>=2.0.0))) resolved by: osgi.wiring.package; org.apache.commons.csv 1.2.0 from org.apache.commons.csv [133] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.lang3.time)(version>=3.3.0)(!(version>=4.0.0))) resolved by: osgi.wiring.package; org.apache.commons.lang3.time 3.4.0 from org.apache.commons.lang3 [132]
osgi.wiring.package; (osgi.wiring.package=org.apache.http) resolved by:
osgi.wiring.package; org.apache.http 4.3.3 from org.apache.httpcomponents.httpcore [90] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.auth)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.auth 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.client)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.client 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.client.entity)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.client.entity 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.client.methods)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.client.methods 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.client.utils)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.client.utils 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.conn)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.conn 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.conn.scheme)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.conn.scheme 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (osgi.wiring.package=org.apache.http.entity) resolved by: osgi.wiring.package; org.apache.http.entity 4.3.3 from org.apache.httpcomponents.httpcore [90] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.impl.auth)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.impl.auth 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.impl.client)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.impl.client 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.impl.conn)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.impl.conn 4.3.6 from org.apache.httpcomponents.httpclient [89] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.message)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.message 4.3.3 from org.apache.httpcomponents.httpcore [90] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.params)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.params 4.3.3 from org.apache.httpcomponents.httpcore [90] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.protocol)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.protocol 4.3.3 from org.apache.httpcomponents.httpcore [90] osgi.wiring.package; (&(osgi.wiring.package=org.apache.http.util)(version>=4.2.0)(!(version>=5.0.0))) resolved by: osgi.wiring.package; org.apache.http.util 4.3.3 from org.apache.httpcomponents.httpcore [90] osgi.wiring.package; (&(osgi.wiring.package=org.apache.log4j)(version>=1.2.0)(!(version>=2.0.0))) resolved by: osgi.wiring.package; org.apache.log4j 1.2.15 from org.ops4j.pax.logging.pax-logging-api [1] osgi.wiring.package; (&(osgi.wiring.package=org.apache.log4j.xml)(version>=1.2.0)(!(version>=2.0.0))) resolved by: osgi.wiring.package; org.apache.log4j.xml 1.2.15 from org.ops4j.pax.logging.pax-logging-api [1] osgi.wiring.package; (&(osgi.wiring.package=org.apache.thrift)(version>=0.9.0)(!(version>=1.0.0))) resolved by: osgi.wiring.package; org.apache.thrift 0.9.2 from org.apache.thrift [135] osgi.wiring.package; (&(osgi.wiring.package=org.apache.thrift.meta_data)(version>=0.9.0)(!(version>=1.0.0))) resolved by: osgi.wiring.package; org.apache.thrift.meta_data 0.9.2 from org.apache.thrift [135] osgi.wiring.package; (&(osgi.wiring.package=org.apache.thrift.protocol)(version>=0.9.0)(!(version>=1.0.0))) resolved by: osgi.wiring.package; org.apache.thrift.protocol 0.9.2 from org.apache.thrift [135] osgi.wiring.package; (&(osgi.wiring.package=org.apache.thrift.scheme)(version>=0.9.0)(!(version>=1.0.0))) resolved by: osgi.wiring.package; org.apache.thrift.scheme 0.9.2 from org.apache.thrift [135] osgi.wiring.package; (&(osgi.wiring.package=org.apache.thrift.transport)(version>=0.9.0)(!(version>=1.0.0))) resolved by: osgi.wiring.package; org.apache.thrift.transport 0.9.2 from org.apache.thrift [135] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.7.0)(!(version>=2.0.0))) resolved by: osgi.wiring.package; org.slf4j 1.7.7 from org.ops4j.pax.logging.pax-logging-api [1]
osgi.ee; (&(osgi.ee=JavaSE)(version=1.8)) resolved by:
osgi.ee; JavaSE [1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0] from org.apache.felix.framework [0]
karaf@root()>

Thanks,
-Ben7



On 09/28/2015 02:53 PM, Andy Seaborne wrote:
Ben,

On 28/09/15 14:49, Ben Gould wrote:
Hi Andy,

I am using the apache-jean-osgi (I think).  Here is the bundle's maven
GAV that I'm using (in Karaf):

<dependency>
    <groupId>org.apache.jena</groupId>
    <artifactId>jena-osgi</artifactId>

Better is apache-jena-osgi - that's the stable point. At the moment, all it pulls on is jena-osgi so (as far as I know) you should be OK with that.

    <version>3.0.0</version>
</dependency>

After running in debug in Eclipse, I noticed it was doing some class
loading, so I tried hard coding the BaseReaderClassName to
org.apache.jena.rdfxml.xmlinput.JenaReader in the RDFReaderFImpl, but
then I got this:

java.lang.IncompatibleClassChangeError: Class
org.apache.jena.rdfxml.xmlinput.impl.RDFXMLParser$SAXParserWithEncodingCheck
does not implement the requested interface org.xml.sax.XMLReader

I think the fundamental problem is that org.xml.sax.XMLReader is incompatible with org.apache.jena.rdfxml.xmlinput.JenaReader, not a problem with oaj.rdf.xml.xmlinput.JenaReader.

If it's picking up the wrong Xerces, that would account for it. But there are other things that are odd (like why RIOT is not intercepting the ModelCom.read).

Is the ModelFactory.createOntologyModel the first line of Jena code called anywhere? It really needs someone more skilled in OSGi than me at this point. Could you please raise a JIRA and provide a simple piece of code that causes the problem? Then we have exactly the same situation to test.

    Andy

     at
org.apache.jena.rdfxml.xmlinput.SAX2RDF.installHandlers(SAX2RDF.java:171)
     at
org.apache.jena.rdfxml.xmlinput.impl.RDFXMLParser.<init>(RDFXMLParser.java:63)

     at
org.apache.jena.rdfxml.xmlinput.impl.RDFXMLParser.create(RDFXMLParser.java:127)

     at
org.apache.jena.rdfxml.xmlinput.JenaReader.<init>(JenaReader.java:69)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)[:1.8.0_11]
     at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_11]

     at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_11]

     at
java.lang.reflect.Constructor.newInstance(Constructor.java:408)[:1.8.0_11]
     at java.lang.Class.newInstance(Class.java:433)[:1.8.0_11]
     at
org.apache.jena.rdf.model.impl.RDFReaderFImpl.getReader(RDFReaderFImpl.java:120)

     at org.apache.jena.rdf.model.impl.ModelCom.read(ModelCom.java:279)
     at
org.apache.jena.ontology.OntDocumentManager.findMetadata(OntDocumentManager.java:892)

     at
org.apache.jena.ontology.OntDocumentManager.initialiseMetadata(OntDocumentManager.java:850)

     at
org.apache.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:198)

     at
org.apache.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:180)

     at
org.apache.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:164)

     at
org.apache.jena.ontology.OntDocumentManager.getInstance(OntDocumentManager.java:242)

     at
org.apache.jena.ontology.OntModelSpec.getDocumentManager(OntModelSpec.java:320)

     at
org.apache.jena.ontology.impl.OntModelImpl.getDocumentManager(OntModelImpl.java:189)

     at
org.apache.jena.ontology.impl.OntModelImpl.loadImports(OntModelImpl.java:1964)

     at
org.apache.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:151)
     at
org.apache.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:131)
     at
org.apache.jena.rdf.model.ModelFactory.createOntologyModel(ModelFactory.java:288)

     ...


Thanks!
-Ben


On 09/26/2015 04:17 AM, Andy Seaborne wrote:
Hi Ben,

Are you using apache-jena-osgi or a different bundling of jena?

The stacktrace is rather strange - the RIOT initialization (for code
in jena-arq) isn't running and the trace is for the old, legacy way to
read data.

Which jars from the jena distribution (or maven) are you using?

IncompatibleClassChangeError indicates an incompatible XMLReader. If
you do not have the Xerces from the jena distribtion, your code might
be picking up the one from the runtime libraries.  That's a lot older
than the one that Jena ships and Jena uses other aspects of Xerces
than just the XML parsing.

    Andy

On 25/09/15 20:28, Ben Gould wrote:
Hi all,

Has anyone seen something like the stacktrace listed below before? I'm
trying to generate provenance rdf in a service running in an Karaf OSGi
runtime, but when it gets to:

final OntModel model =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);

It has trouble creating the OntModel object because of the stack trace
below.  I'm guessing it has to do with the classes available to it at
runtime, as it runs fine outside of the OSGi container.


2015-09-25 14:35:30,946 | ERROR | raf-4.0.1/deploy |
cas_simple-word-count            | 140 -
com.inovexcorp.cas_simple-word-count - 0.0.1.SNAPSHOT |
[cas.service.simple.word_count.SimpleWordcountService(8)] The activate
method has thrown an exception
java.lang.IncompatibleClassChangeError: Class
org.apache.jena.rdfxml.xmlinput.impl.RDFXMLParser$SAXParserWithEncodingCheck

does not implement the requested interface org.xml.sax.XMLReader
     at
org.apache.jena.rdfxml.xmlinput.SAX2RDF.installHandlers(SAX2RDF.java:171)

     at
org.apache.jena.rdfxml.xmlinput.impl.RDFXMLParser.<init>(RDFXMLParser.java:63)


     at
org.apache.jena.rdfxml.xmlinput.impl.RDFXMLParser.create(RDFXMLParser.java:127)


     at
org.apache.jena.rdfxml.xmlinput.JenaReader.<init>(JenaReader.java:69)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)[:1.8.0_11]
     at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_11]


     at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_11]


     at
java.lang.reflect.Constructor.newInstance(Constructor.java:408)[:1.8.0_11]

     at java.lang.Class.newInstance(Class.java:433)[:1.8.0_11]
     at
org.apache.jena.rdf.model.impl.RDFReaderFImpl.getReader(RDFReaderFImpl.java:120)


at org.apache.jena.rdf.model.impl.ModelCom.read(ModelCom.java:279)
     at
org.apache.jena.ontology.OntDocumentManager.findMetadata(OntDocumentManager.java:892)


     at
org.apache.jena.ontology.OntDocumentManager.initialiseMetadata(OntDocumentManager.java:850)


     at
org.apache.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:198)


     at
org.apache.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:180)


     at
org.apache.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:164)


     at
org.apache.jena.ontology.OntDocumentManager.getInstance(OntDocumentManager.java:242)


     at
org.apache.jena.ontology.OntModelSpec.getDocumentManager(OntModelSpec.java:320)


     at
org.apache.jena.ontology.impl.OntModelImpl.getDocumentManager(OntModelImpl.java:189)


     at
org.apache.jena.ontology.impl.OntModelImpl.loadImports(OntModelImpl.java:1964)


     at
org.apache.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:151)
     at
org.apache.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:131)
     at
org.apache.jena.rdf.model.ModelFactory.createOntologyModel(ModelFactory.java:288)


...


Thanks,
-Ben






Reply via email to