package not found running ObjectDB under OSGi



I have created in Eclipse a new plugin from existing jar file and than I tried to enhance my classes (using Ehancer from that new bundle), however I got an error : 

[ObjectDB 2.2.8_02] Package datamodel.core.base is not found by the enhancer (error 108)

The Enhancer was run in the following way : 

    public void start(BundleContext context) throws Exception {
        ClassLoader classLoader =   context.getBundle().loadClass("datamodel.core.base.NamedCoreObj").getClassLoader();

      Enhancer.enhance("datamodel.core.base.*", classLoader);


The classLoader I pass has definitely access to the NamedCoreObj class.

Also package datamodel.core.base was set in my primary plugin as Exported during Runtime.

So what is wrong ?? Do you really use that second parameter ?? Don't you have a bug ??


Thanks in advance



This is not a bug but a limitation. Java doesn't provide an API for locating all the classes in a package. ObjectDB can still locate classes of specific file based class loaders (by scanning the file system) but not in the general case, and apparently Eclipse class loader is not supported.

In addition, please notice this restriction regarding using ObjectDB in an Eclipse plugin.

ObjectDB Support