|Re: [eclipselink-users] Re: rcp, osgi, and dynamic weaving|
Hi Sandro,A colleague and I have been taking a look at this and seeing some issues that we were not seeing a few months ago. I am not sure if it is the version of Equinox or Eclipse we are using or something else. We are going to continue to dig into this and hopefully come up with something.
After our JPA 2.0 release, I hope to be able to put significantly more time into making this stuff easier to use so it is less frustrating. The easiest workarounds are to either use our static weaving or not to weave at all.
Hopefully we'll have some better guidance for you in the near future, Tom S. A. wrote:
Hi TomI am in the same boat, also struggling to get dynamic weaving work. Following your instructions and doing some investigation of the code myself, I made quite some progress, but now I've got a problem I can not figure out how to solve it.Before, describing my problem, I quickly describe what I've done so far: I checked out the following two projects from svn: org.eclipse.persistence.jpa.equinox org.eclipse.persistence.jpa.equinox.weavingIn order to get the hook activated, I exported the weaving bundle (=created a jar), and put this jar into the same directory where the /org.eclipse.osgi_XX.jar/ bundle resides. Further I had to provide the following VM argument, as suggested:-Dosgi.framework.extensions=org.eclipse.persistence.jpa.equinox.weavingSo far so good. By checking the console output I could verify that the hook is loaded. And by debuging, I could even verify that the /processClass/ method of the /WeaverRegistry/ class is called. Weaving, however, does not take place, because the list of /weaverServices/ is empty. Investigating the code of the other bundle I noticed, that the /EquinoxInitializer /is in charge of registering the service the /WeaverRegistry /requires. But to my astonishment the /EquinoxInitializer /class has not been "touched" at all, when I started up my application. Further investigations revealed that this class is only used, when the fully qualified name of the class is passed as a constructor argument when instantiating the /org.eclipse.persistence.jpa.osgi.PersistenceProvider /class.Having changed my code accordingly, the /EquinoxInitializer /class is now also involved when it comes to create an entity manager factory. The service mentioned above, however, is still not registered due to an exception that occurs before the respective operation takes place. The exception that occurs is that the nested /TempEquinoxEntityLoader /classloader is not able to find the entities that are defined in the /persistence.xml/ file. I reckon the problem lies in my bundle-structure, having the domain-models (=my entities) in a different bundle than the class that creates and uses the /PersistenceProvider./ And this where I am stuck now. How can I solve this problem?Note that the bundle where the /PersistenceProvider/ is created has a dependency set to the bundle that contains the domain models, hence the entities should be accessible from this bundle. I even added this dependency (in desperation) to the /org.eclipse.persistence.jpa.equinox /bundle, but without success.This is, how I create the PersistenceProvider to acquire an entity manager: PersistenceProvider provider = new PersistenceProvider(OSGiPersistenceInitializationHelper.EQUINOX_INITIALIZER_NAME); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("eclipselink.classloader", this.getClass().getClassLoader()); provider.createEntityManagerFactory(emName, properties); Any advice is highly appreciated! Thanks in advance! -Sandro ------------------------------------------------------------------------ _______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users
Back to the top