Eclipse RCP, Spring, Hibernate class loading issue

I'm developing an RCP based application that uses a data access layer implemented using Spring data JPA supported by hibernation. The domain annotated classes are in the same jar / bundle, the Spring and Spring config repositories for instantiating the datasource, entity manager and transaction manager are in another bundle. These jars are used by other non-RCP applications throughout the project. I have all the dormant 3.6.8 jars and dependencies that are either wrapped or exposed via my own plugins or as OSGI packages (jta, antlr, collection collections, etc.) on the target platform. I'm using Eclipse Gemini Blueprint to manage Spring package context in RCP application.

When the Spring DAL context is initialized by the gemini extender, I get hibernate-specific ClassDefNotFound exceptions, usually either at org.hibernate.ejb.HibernatePersistence or javax.persistence.spi.Persistenceprovider. Ive tried to put all hibernating jars and dependencies in one plugin that exports javax and hibernate packages. Ive tried to set Eclipse Buddy policies in the manifest of the plugins I control over, etc.

I was unable to find a solution to this problem when loading this class between Spring and Hibernate under Eclipse RCP using Gemini. I've done past habernate DAO projects in RCP putting all the sleeping jars in the same plugin as my domain and DAO classes, so only my classes are exported.

At this point, I don't think switching to a more OSGI-friendly JPA provider like OpenJPA or EclipseLink is an option.

I found an answer to a slightly related question that suggested putting all Spring jars and dependencies in one plugin, with hibernation basses and dependencies in another plugin with buddy policies set. It seems messy when most of the jars involved are OSGi packages.

I suppose I could create a plugin that stores DAL jars, hibernate and Spring ORM jars so they can see each other.

Is there a clean way to get this to work?

+3


source to share


1 answer


Kernel, if you own it, add any suspicious packages as registered friends and make sure you re-define packages or packages, otherwise sometimes the friends class loading won't work. If the download is initiated from your package, the eclipse buddy policy should cascade. Another option would be to change the most useful files in the target packages causing the problems.



0


source