DataNucleus jars are OSGi bundles, and as such, can be deployed in an OSGi environment.
Being an OSGi environment care must be taken with respect to class-loading. In particular
the persistence property
will need setting.
Please refer to the following guide(s) for assistance until a definitive guide can be
An important thing to note : any dependent jar that is required by DataNucleus needs to be OSGi enabled.
By this we mean the jar needs to have the MANIFEST.MF file including
the packages required by DataNucleus. Failure to have this will result in
when trying to load its classes.
Note that the
that is included in the DataNucleus distribution is OSGi enabled.
Also the Geronimo "jpa" jar that is included in the DataNucleus distribution is OSGi enabled too.
In a non OSGi world the persitence provider implementation is loaded using the service provider pattern.
The full qualified name of the implementation is stored in a file under
(inside the jar of the implementation)
and each time the persistence provider is required it gets loaded with a
name of the implementing class found inside the
. In the OSGi world that doesn't work.
The bundle that needs to load the persistence provider implementation cannot load
. A work around is to copy that file
inside each bundle that requires access to the peristence provider. Another work around is to export the
persistence provider as OSGi service. This is what the DataNucleus JPA jar does.
Further reading available on