[
https://issues.apache.org/jira/browse/JENA-566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13807858#comment-13807858
]
Andy Seaborne commented on JENA-566:
------------------------------------
The problem is in the bundling. jena-core makes a reflection call to set up
RIOT, and RIOT installs JenaReadersWriters$RDFReaderRIOT_RDFXML. This is
instantiated with call of Class.newInstance(). It looks like the latter is
failing.
This may be because of classloaders as setup by the OSGi bundling. You probably
want one bundle with all of the Jena jars in it. As I understand your reported
setup, you have a separate bundle, hence a different classloader, hence not
found.
> Strange behaviour of Jena in OSGi Blueprint
> -------------------------------------------
>
> Key: JENA-566
> URL: https://issues.apache.org/jira/browse/JENA-566
> Project: Apache Jena
> Issue Type: Bug
> Components: ARQ
> Environment: OSGi blueprint ARQ 2.11.1-SNAPSHOT
> Reporter: Izaskun
> Priority: Minor
> Labels: jena, osgi, riot, sdb
> Fix For: Jena 2.11.1
>
> Original Estimate: 5h
> Remaining Estimate: 5h
>
> Everytime I do a:
> *model.read(input, null);*
> I get:
> {quote}com.hp.hpl.jena.shared.ConfigException: Reader not found on classpath
> at
> com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.getReader(RDFReaderFImpl.java:108)
> ClassNotFoundException:
> org.apache.jena.riot.adapters.JenaReadersWriters$RDFReaderRIOT_RDFXML{quote}
> I'm working in an OSGi blueprint environment. When I test this in a normal
> environment, everything works ok.
> My source code is:
> {quote} final String modelText = "\n"
> + "<rdf:RDF \n"
> + " xmlns:res=\"http://www.w3.org/2005/sparql-results#\"
> xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"> \n"
> + " <rdf:Description
> rdf:about=\"http://www.w3.org/2005/sparql-results#ResultSet\">\n"
> + " <res:solution rdf:nodeID=\"r0\"/>\n"
> + " <res:solution rdf:nodeID=\"r1\"/>\n"
> + " <res:solution rdf:nodeID=\"r2\"/>\n"
> + " </rdf:Description>\n" + "</rdf:RDF>";
> final Model model = ModelFactory.createDefaultModel();
> model.read(new ByteArrayInputStream(modelText.getBytes()), null);
> model.close();{quote}
> I also add this in my pom, but it seems to do nothing:{quote}
> <!-- jena bundle can run stand along without ARQ. However if
> ARQ is present then it can call RDFReaderF to specify that
> various RIOT
> readers should be used instead of the ones in the jena bundle.
> The jena bundle
> therefore needs access to the RIOT classes. So define an
> optional dependency
> from the jena bundle to the arq bundle. This allows RDFReaderF
> to load the
> RIOT parser classes. -->
> <Require-Bundle>
>
> wrap_mvn_org.apache.jena_jena-arq_2.11.1-SNAPSHOT;resolution:=optional
> </Require-Bundle>{quote}
--
This message was sent by Atlassian JIRA
(v6.1#6144)