![]() |
![]() |
|
Welcome
Guest
| Register
| Login
|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 8 |
|
| Author |
|
|
Newbie Joined: Jan 19, 2008 Post Count: 8 Status: Offline |
Hi, Anyone tried integrating JPOX/DataNucleus into Spring Dynamic Modules (Spring DM)? Now that I have jars running as bundles inside the OSGi container, but does the same precautions described in JPOX+Spring+Eclipse RCP applies too for Spring DM + OSGi environments? TIA |
||
|
|
Newbie Joined: Jan 19, 2008 Post Count: 8 Status: Offline |
Nobody? I was planning to have an OSGi bundle to provide the PersistenceManagerFactory instance, using the entity object classes it can found on the imports in the manifest. When setting up JDOPersistenceManagerFactory, I event explicitly set the property datanucleus.classLoaderResolverName in its options attribute, as I got an exception related to this (see below): But I got such an exception when the bundle started. (Spring-related exception stack traces removed) Anyone can help? TIA. |
||
|
|
Advanced Member Germany Joined: Jun 18, 2004 Post Count: 405 Status: Offline |
I didn't understand really, what is the exception you get when you do set "datanucleus.classLoaderResolverName=jdo", and which do you get when you don't set that property? Or do you get that exception you quoted in both cases, i.e. no matter whether you set "datanucleus.classLoaderResolverName" or not? |
||
|
|
Newbie Joined: Jan 19, 2008 Post Count: 8 Status: Offline |
I didn't understand really, what is the exception you get when you do set "datanucleus.classLoaderResolverName=jdo", and which do you get when you don't set that property? Or do you get that exception you quoted in both cases, i.e. no matter whether you set "datanucleus.classLoaderResolverName" or not? Yes, both cases. Exception was thrown before and after I set this property. Digging the stack trace a bit deeper revealed that it couldn't even find the plugin.xml on the classpath hierarchy; so I think it is really the classloader's problem. As a part of the crash course, I also tried using EclipsePluginRegistry too: With the manifest declared as follows: The exception thrown changed to Which is quite weird, as the Eclipse Equinox jar is imported too. ![]() |
||
|
|
Newbie Joined: Jan 19, 2008 Post Count: 8 Status: Offline |
Sorry to dig this back up, but my integration effort is rather hobbyist than required :) that's why it's moving so slowly, though I do hope my effort will eventually make DataNucleus a citizen the same class as Hibernate in the OSGi environment. Anyway, I think the problems ahead might require people with knowledge in OSGi to answer them. My strategy turned to using a Spring's FactoryBean to do all the initializations, then expose it to the OSGi environment via Spring DM. As a (desperate) attempt, I wrote this: package system.alpha.s2.core.dao.jdo;It's using Spring's API directly, but I think it's not difficult to write one with OSGi Activator interface. Also you can see it's not finished yet, as I was still stuck with class loading problems - please read on. The PluginRegistry is internal to this FactoryBean as it need to access the BundleContext of the OSGi environment. But when it starts, the PluginRegistryFactory complained (using JDK 1.4 logging here): 04-Sep-2008 11:54:11 org.datanucleus.plugin.PluginRegistryFactory newInstanceI think I might gave a wrong ClassLoader to DataNucleus again... ![]() To move forward, the question (before thinking if my code was wrong) becomes: which class's ClassLoader should I use? Or I shouldn't use inner classes at all? If so what should I do? ---------------------------------------- [Edit 1 times, last edit by airwave209 at Sep 4, 2008 5:06:53 AM] |
||
|
|
Expert UK / EspaƱa Joined: Mar 13, 2004 Post Count: 4882 Status: Offline |
Why not ask Spring people? They claim to be contributing so much to OSGi, so they must know what is different in their environment to what an OSGi container like Equinox/Felix offer (and enough people have it working in those) - I've not had the time to use either. They should also be looking to get as wide as support as possible for data persistence, hence should know how to handle JDO class loading. ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Newbie Joined: Jan 19, 2008 Post Count: 8 Status: Offline |
OK, I'll ask them and post the results back. ![]() |
||
|
|
Newbie Joined: Nov 30, 2008 Post Count: 1 Status: Offline |
Coincidently I was experimenting with a similar setup: OSGi (equinox 3.4) and Spring DM and ran into the same issue. I think the issue is not directly related to SpringDM; It also surfaces in a normal 'vanilla' Equinox OSGi environment (without eclipse). So IMHO it looks more like a Datanuclues issue. It's not a bug; It's just something thats not really obvious when you use OSGi and Datanucleus together for the first time. I created the following class which is a subclass of the LocalPersistenceManagerFactoryBean as a quick test/fix: With this class you can create a Persistent Bean in Spring DM like you would normally do in standalone spring: If you want to use Datanucleus with OSGi WITHOUT Spring DM then you will need something similar; get an instance of the BundleContext (for example in the activator) and from there find the classloader of JDOClassLoaderResolver. Since I'm relatively new to OSGi, Spring DM and Datanucleus I have no idea if this is the correct way of doing things (Maybe someone can comment on that ?) , I just know it works Something to keep in mind with all this is that a Eclipse Plugin != 100% OSGi Bundle. The MANIFEST.MF defines the OSGi bundle part, however the plugin.xml is part of a special eclipse infrastructure for plugin extensionpoints which is not present in a vanilla OSGi implementation like Eclipse Equinox or Apache Felix. Thats why using "org.datanucleus.plugin.EclipsePluginRegistry" in a plain OSGi environment won't work. |
||
|
|
|
|
|
Current timezone is GMT Dec 2, 2008 3:33:20 PM |