Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Gemini doesn't read parent classes from another bundles(Gemini doesn't read parent classes from another bundles)
icon3.gif  Gemini doesn't read parent classes from another bundles [message #1732417] Tue, 17 May 2016 07:01 Go to next message
Pavel No is currently offline Pavel NoFriend
Messages: 45
Registered: May 2016
Member
I have three bundles. In first bundle I have persistence.xml. And I have two classes : A and B. A extends B. Class A is @Entity, Class B is @MappedSuperclass.Both classes are listed in persistence.xml. Packages of the 2'dn and 3'rd bundles are exported.

If class A and class B are in the same bundle - everything ok. However, when class A in the second bundle and class B is the the third bundle I get:

WARNING: EMFProxy invocation on method createEntityManager failed:  Exception: Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: org.eclipse.gemini.jpa.classloader.CompositeClassLoader@20c0a64d
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [myPersistenceUnit] failed.
Internal Exception: java.lang.NullPointerException
java.lang.NullPointerException: null
	at org.eclipse.persistence.internal.jpa.weaving.TransformerFactory.createClassDetails(TransformerFactory.java:270)
	at org.eclipse.persistence.internal.jpa.weaving.TransformerFactory.addClassDetailsForMappedSuperClasses(TransformerFactory.java:124)
	at org.eclipse.persistence.internal.jpa.weaving.TransformerFactory.buildClassDetailsAndModifyProject(TransformerFactory.java:180)
	at org.eclipse.persistence.internal.jpa.weaving.TransformerFactory.createTransformerAndModifyProject(TransformerFactory.java:84)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1972)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:100)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:104)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188)
	at org.eclipse.gemini.jpa.ProviderWrapper.createEntityManagerFactory(ProviderWrapper.java:128)
	at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.createEMF(EMFServiceProxyHandler.java:151)
	at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.syncGetEMFAndSetIfAbsent(EMFServiceProxyHandler.java:127)
	at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.invoke(EMFServiceProxyHandler.java:73)
	at com.sun.proxy.$Proxy8.createEntityManager(Unknown Source)


When I set in persistence.xml

<property name="eclipselink.weaving" value="false"/>


I don't get any exceptions, but all fields from class B are ignored. How to solve this problem?

[Updated on: Tue, 17 May 2016 07:27]

Report message to a moderator

Re: Gemini doesn't read parent classes from another bundles [message #1732495 is a reply to message #1732417] Tue, 17 May 2016 16:51 Go to previous messageGo to next message
Pavel No is currently offline Pavel NoFriend
Messages: 45
Registered: May 2016
Member
I solved the problem. The problem was in the first bundle. It didn't import packages from bundle with class B as its code didn't know anything about class B. So I had to add in manifest file of the first bundle osgi directive import package - class B package. The problem in EclipseLink is that it didn't throw any exceptions about class not found or something like this even with logging level All.
Re: Gemini doesn't read parent classes from another bundles [message #1732498 is a reply to message #1732417] Tue, 17 May 2016 16:58 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 243
Registered: July 2009
Senior Member
Pavel,

See the Limitations link here: https://wiki.eclipse.org/Gemini/JPA/Documentation/Limitations

Basically the OSGi spec to support JPA states that all persistent entities must be in the same bundle. (I didn't make that rule!)

-Mike
Re: Gemini doesn't read parent classes from another bundles [message #1732499 is a reply to message #1732498] Tue, 17 May 2016 17:12 Go to previous messageGo to next message
Pavel No is currently offline Pavel NoFriend
Messages: 45
Registered: May 2016
Member
Hi Mike

Thank you for your comment. I've read the limitations. However, my code works! What should I do now? Maybe this limitation doesn't consider @MappedSuperclass?
Re: Gemini doesn't read parent classes from another bundles [message #1732504 is a reply to message #1732499] Tue, 17 May 2016 18:47 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 243
Registered: July 2009
Senior Member
The limitation is one that was imposed as we got JPA standardized in OSGi. It was mostly artificial and I did not throw up any barriers to the provider supporting it, but I also did not jump through any hoops to try to get it working either. If you have a situation that works and EclipseLink 2.6.3 supports it then you should be fine. Stick with it Smile

-Mike
Re: Gemini doesn't read parent classes from another bundles [message #1732533 is a reply to message #1732504] Wed, 18 May 2016 02:50 Go to previous message
Pavel No is currently offline Pavel NoFriend
Messages: 45
Registered: May 2016
Member
Thank you for your answer. I totally agree with you that this limitation is artificial and I find it rather strange according to osgi modularity principles. So thank you, that didn't implement this limitation and please, don't implement it in future Smile
Previous Topic:Gemini Blueprint Spring 4 support
Next Topic:java.lang.IllegalArgumentException while stopping my bundle
Goto Forum:
  


Current Time: Wed Sep 19 05:31:17 GMT 2018

Powered by FUDForum. Page generated in 0.02426 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top