[
https://issues.apache.org/jira/browse/JENA-328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin W. updated JENA-328:
---------------------------
Comment: was deleted
(was: Hi Damian, hello everyone,
Unfortunately I could not get it to work here with your solution. Again, I'm
getting "com.hp.hpl.jena.sparql.ARQInternalErrorException: Can't create a
javax.xml DatatypeFactory" (I'll attach the full stacktrace after posting).
However, I tried adding the entries for OSGi Import-Package in my MANIFEST
(org.apache.xerces.jaxp, org.apache.xerces.jaxp.datatype,
org.apache.xerces.jaxp.validation) --- the root cause ClassNotFoundException
persists... :(
Should I reopen the issue?
All the best,
Martin)
> NodeValue makes assumptions about ClassLoader --- "nasty problem in OSGi
> environments"
> --------------------------------------------------------------------------------------
>
> Key: JENA-328
> URL: https://issues.apache.org/jira/browse/JENA-328
> Project: Apache Jena
> Issue Type: Bug
> Components: ARQ, Jena
> Affects Versions: Jena 2.7.3
> Environment: OSGi: Virgo Server for Apache Tomcat
> Reporter: Martin W.
> Assignee: Damian Steer
> Priority: Minor
> Fix For: ARQ 2.9.4
>
>
> com.hp.hpl.jena.sparql.expr.NodeValue.java: in lines 175ff:
> A new instance of a DatatypeFactory is created with .newInstance() --- there
> assumptions are made about the classloader. Such things make it difficult to
> use Jena in an OSGi-Environment like Virgo.
> Here's my fix: (get the correct classloader first and call newInstance with
> that classloader as parameter)
> {
> try {
> ClassLoader cl =
> com.hp.hpl.jena.sparql.expr.NodeValue.class.getClassLoader();
> xmlDatatypeFactory =
> DatatypeFactory.newInstance(DatatypeFactory.DATATYPEFACTORY_IMPLEMENTATION_CLASS,
> cl) ; }
> catch (DatatypeConfigurationException ex)
> { throw new ARQInternalErrorException("Can't create a javax.xml
> DatatypeFactory", ex) ; }
> }
> This fix did it for me. However, the JavaDoc for
> DatatypeFactory.DATATYPEFACTORY_IMPLEMENTATION_CLASS states "Users should not
> refer to this field; it is intended only to document a factory implementation
> detail. "
> NOTE: furthermore I added the original exception ex to:
> throw new ARQInternalErrorException("Can't create a javax.xml
> DatatypeFactory", ex)
> I think I have seen similar situations in the Jena source code several times
> --- I would like to see the original exception handed over when new ones are
> created whenever possible. Using Jena in an OSGi-Environment this would make
> my life a lot easier.... ;)
> Should i file separate bugs for these things in the future?
> For more information on OSGi and classloaders see also
> http://stackoverflow.com/questions/1043109/why-cant-jaxb-find-my-jaxb-index-when-running-inside-apache-felix
> Hanno Fietz wrote there "... quite nasty problem in OSGi environments when
> you're using libraries that aren't designed for OSGi and make assumptions
> about the classloader they get."
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira