Results 1 to 6 of 6

Thread: Spring DM Server & EclipseLink

  1. #1
    Join Date
    Oct 2008
    Posts
    12

    Default Spring DM Server & EclipseLink

    All,

    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
    springsource-dm-server-1.0.0.RELEASE\repository\bundles\usr

    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
    stence.internal.jpa.deployment,org.eclipse.persist ence.internal.jpa.d
    eployment.osgi,org.eclipse.persistence.internal.jp a.deployment.xml.pa
    rser,org.eclipse.persistence.internal.jpa.jdbc,org .eclipse.persistenc
    e.internal.jpa.metadata,org.eclipse.persistence.in ternal.jpa.metadata
    .accessors,org.eclipse.persistence.internal.jpa.me tadata.accessors.cl
    asses,org.eclipse.persistence.internal.jpa.metadat a.accessors.mapping
    s,org.eclipse.persistence.internal.jpa.metadata.ac cessors.objects,org
    .eclipse.persistence.internal.jpa.metadata.cache,o rg.eclipse.persiste
    nce.internal.jpa.metadata.changetracking,org.eclip se.persistence.inte
    rnal.jpa.metadata.columns,org.eclipse.persistence. internal.jpa.metada
    ta.converters,org.eclipse.persistence.internal.jpa .metadata.copypolic
    y,org.eclipse.persistence.internal.jpa.metadata.in heritance,org.eclip
    se.persistence.internal.jpa.metadata.listeners,org .eclipse.persistenc
    e.internal.jpa.metadata.locking,org.eclipse.persis tence.internal.jpa.
    metadata.queries,org.eclipse.persistence.internal. jpa.metadata.sequen
    cing,org.eclipse.persistence.internal.jpa.metadata .tables,org.eclipse
    .persistence.internal.jpa.metadata.transformers,or g.eclipse.persisten
    ce.internal.jpa.metadata.xml,org.eclipse.persisten ce.internal.jpa.tra
    nsaction,org.eclipse.persistence.jpa,org.eclipse.p ersistence.jpa.osgi
    ,org.eclipse.persistence.tools.weaving.jpa

    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
    springsource-dm-server-1.0.0.RELEASE\repository\bundles\ext
    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.

  2. #2
    Join Date
    Oct 2008
    Posts
    12

    Default

    Additionally,

    When I telnet to the equinox/felix osgi container.

    The eclipsejpa is active and is exporting:

    org.eclipse.persistence.jpa; version="0.0.0"[exported]
    org.eclipse.persistence.jpa.osgi; version="0.0.0"[exported]

    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
    .NoClassDefFoundError: org/eclipse/persistence/jpa/PersistenceProvider

  3. #3
    Join Date
    Jan 2006
    Location
    Zürich, Switzerland
    Posts
    423

    Default

    Hi Eric,

    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?

    Regards,

    Sam

  4. #4
    Join Date
    Oct 2008
    Posts
    12

    Default

    Quote Originally Posted by Sam Brannen View Post
    Hi Eric,

    First: did you restart the dm Server after installing the EclipseLink bundles in the bundle repository?
    Yup.

    Quote Originally Posted by Sam Brannen View Post
    Second: have you taken a look at the <url removed> which uses EclipseLink within a PAR?

    Regards,

    Sam
    Yeah, that's what I am looking at currently.

    Thanks.

  5. #5
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Eric,

    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).

    HTH

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  6. #6
    Join Date
    Oct 2008
    Posts
    12

    Default

    Rob,

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •