Now that I have the SDO jars recognized as OSGi bundles, I'm trying to run a simple test that I had working with the standalone jars.

When I execute:

XSDHelper.INSTANCE.define(schema, null);

I end up with a NullPointerException.  I've tracked down root cause ...

The static initializer of the HelperProvider executes this code:

  provider = getInstance(HelperProvider.class.getClassLoader());

which ends up calling:

  HelperProvider provider = loadImplementation(cl, implName);

implName is null so

        if (implName == null) {
            implName = getImplementationName(cl);
        }

ends up calling

  implName = getImplementationName(cl);

which ends up calling:

  InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME);

where SERVICE_RESORUCE_NAME = "META-INF/services/ commonj.sdo.impl.HelperProvider" getResourceAsStream() return null because META-INF/services does not exist in the API bundle. It exists in the IMPL bundle and since you are using the class loader from the API bundle, it won't work.

You can set

- Dcommonj.sdo.impl.HelperProvider=org.apache.tuscany.sdo.helper.HelperPro viderImpl

to get around the above problem, but as soon as

  return (HelperProvider) cl.loadClass(implName).newInstance();

executes, you get a CalssNotFoundException. Again, this is because you are trying to load a class outside the bundle with the wrong class loader.

My current conclusion is that SDO is completely broken.

Bryan

Reply via email to