Oct 9th, 2008, 08:41 AM
Spring DM Server & EclipseLink
I'm having trouble with getting eclipselink and spring server dm working.
Caused by: java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/PersistenceProvider
at org.springframework.orm.jpa.vendor.EclipseLinkJpaV endorAdapter.<init>(EclipseLinkJpaVendorAdapter.ja va:51)
1- I deployed the osgi eclipselink 1.1 version in
10/08/2008 11:16 AM 58,159 org.eclipse.persistence.antlr-1.1-M2.jar
10/08/2008 11:16 AM 214,737 org.eclipse.persistence.asm-1.1-M2.jar
10/08/2008 11:16 AM 3,413,391 org.eclipse.persistence.core-1.1-M2.jar
10/08/2008 11:16 AM 443,100 org.eclipse.persistence.jpa-1.1-M2.jar
2- The jpa persistence jpa has the following export: (Which includes the org.eclipse.persistence.jpa)
Export-Package: org.eclipse.persistence.internal.jpa,org.eclipse.p ersi
3- My own bundle creates the EclipseLinkVendorAdapter bean and import-package org.eclipse.persistence.jpa
My questions are:
What & Why is it not seeing the org.eclipse.persistence.jpa classes? [I am guessing the spring bundles aren't seeing the eclipselink osgi bundles] So I tried moving the eclipselink bundles to
and the problem persists...
Any ideas? Is this because spring framework doesn't import the eclipselink bundle? Any ways around this? I will dig into the samples one of which seems to do exactly what I'm doing. I don't quite understand.
Oct 9th, 2008, 08:48 AM
When I telnet to the equinox/felix osgi container.
The eclipsejpa is active and is exporting:
I imagine springframework-orm not having the dependency on eclipselink is the problem. Is this correct? Any way around this?
Basically in my own bundle I do have org.eclipse.persitence.jpa imported,
but when I instantiate the adaptor (EclipseLinkJpaVendorAdapter), it's now in the springframework bundle which doesn't have the import. Is there any way around this? Do I need to bundle spring within my par?
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jpaAdapter' defined in URL [bundleentry://73/META-INF/spring/a
pplicationContext-db-eclipselink.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could n
ot instantiate bean class [org.springframework.orm.jpa.vendor.EclipseLinkJpaV endorAdapter]: Constructor threw exception; nested exception is java.lang
Oct 9th, 2008, 09:41 AM
First: did you restart the dm Server after installing the EclipseLink bundles in the bundle repository?
Second: have you taken a look at the Pet Clinic sample application which uses EclipseLink within a PAR?
Oct 9th, 2008, 09:45 AM
Originally Posted by Sam Brannen
Yeah, that's what I am looking at currently.
Originally Posted by Sam Brannen
Oct 10th, 2008, 03:08 AM
I notice that you are not using EclipseLink bundles from our Enterprise Bundle Repository, rather you are using the ones supplied by the EclipseLink project. The issue here is quite a subtle one.
The EclipseLink-supplied bundles have no explicit version on the exports and therefore have version 0 by default. In EBR, the exported packages have version 1.0/1.1 as appropriate.
The NCDFE is actually coming from the Spring ORM bundle which has an _optional_ dependency on EclipseLink in the range [1.0.0, 2.0.0). Since this is optional, OSGi will silently ignore it if it cannot be satisfied.
My recommendation is to use the EclipseLink bundles from EBR (http://www.springsource.com/reposito...se.persistence).
Oct 10th, 2008, 10:59 AM
Thank you for the indepth explanation.
First off, the reason I am using eclipselink 1.1 was the JPA 2.0 preview feature. [I made a bundle request, but I guess once it's final in Dec it'll appear in SEBR]
What you are pointing out makes sense. [Optional Dependency, failing silently, eclipselink bundles not having correct osgi meta info]
I was trying to expose an entitymanager and was running into the classnotfound exception issue.
I guess my options at this point are:
1- Wait till eclipse 1.1 becomes available [I opened a JIRA ticket & Dec should be eclipselink 1.1 release]
2- Correct the eclipselink-1.1 bundle to add correct osgi headers
3- Try to not expose the entitymanagerfactory via osgi. [Not sure this is feasible in how I have architected the application, I need to check]
Last edited by eric_gulatee; Oct 10th, 2008 at 04:02 PM.
Tags for this Thread