Hi Barry,
In that case I'm totally confused about what's going on.
A self-contained bundle built using the pom I sent you should use an
embedded Xerces you works for me.
If it is not using the embedded Xerces but is finding your 2.9.1 install
then that should work too (I've checked compatibility with 2.9.1).
So we've covered belt and braces and still no joy.
Does your JDK have an "endorsed" directory with a copy of Xerces hidden
away in it?
Best I can suggest is start eliminating variables. I've temporarily put
up a copy of a jena bundle [1] built with [2] and a test bundle [3]
which just does:
public class JenaTest implements BundleActivator {
public static final String DATA_FILE = "/resources/data.rdf";
@Override
public void start(BundleContext context) throws Exception {
System.out.println("Test bundle ...");
Model m = ModelFactory.createDefaultModel();
InputStream in = JenaTest.class.getResourceAsStream(DATA_FILE);
m.read(in, null, FileUtils.langXML);
System.out.println( m.size() > 0 ? "SUCCESS" : "No data");
}
@Override
public void stop(BundleContext context) throws Exception {
System.out.println("Bundle stopped");
}
}
If I drop the two bundles into a vanilla OSGi runner like Equinox then
when the test bundle starts it shows:
Test bundle ...
SUCCESS
for me.
If you test it in your set up on say Equinox and it fails then it
presumably must be your java.
If it works, then try dropping the same jars into your real OSGi
environment. If that fails then there is something weird about that
environment.
If it works, then just need to track the differences between that
pom/jena-bundle and the one you are using.
Dave
[1]
http://www.epimorphics.com/public/temp/com.hp.hpl.jena.core.osgi-2.6.4.jar
[2] http://www.epimorphics.com/public/temp/pom.xml
[3] http://www.epimorphics.com/public/temp/JenaUsers.jar
On Sun, 2011-10-09 at 14:27 -0400, Barry Hathaway wrote:
> Dave,
>
> I'm actually running with a recent version of Xerces (2.9.1).
>
> Barry
>
> On 10/8/2011 10:34 AM, Dave Reynolds wrote:
> > On Fri, 2011-10-07 at 17:49 -0400, Barry Hathaway wrote:
> >> Dave,
> >>
> >> I put Xerces back into the Jena bundle. I checked all the bundles and
> >> the imports/exports
> >> look fine; however, I'm still getting:
> >>
> >> PropertyAccessException 1:
> >> org.springframework.beans.MethodInvocationException: Property
> >> 'kbaseRoot' threw exception;
> >> nested exception is com.hp.hpl.jena.shared.JenaException:
> >> org.apache.xerces.impl.dv.DVFactoryException:
> >> DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does
> >> not extend from DTDDVFactory.
> >>
> >> when I execute the following 3 lines in my application:
> >>
> >> Model m = ModelFactory.createMemModelMaker().createFreshModel();
> >> FileInputStream is = new FileInputStream(file);
> >> m = m.read(is, null);
> >>
> >> with the offending line being the read. Any ideas?
> > Not really. Like I say I make quite heavy use of Jena with OSGi bundles
> > without such problems.
> >
> > So long as the Xerces references in Jena core are being satisfied from
> > the Xerces in the bundle and not from import list then I'm stumped.
> >
> > Can you update the Xerces in your ServiceMix bundle to something a bit
> > more modern which is compatible with Jena?
> >
> >> Do you think it could have something to do with the static classes in
> >> the factory?
> > No, since it works fine in other OSGi environments.
> >
> > Dave
> >
> >
> >
> >
>