Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/PersistenceProvider Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/PersistenceProvider

    I'm trying (for several days ) to get a "EclipseLink powered" SpringDM application working.
    I've got all required bundles from BRITS repository and I've written an osgi application.

    The exception message that make me crazy is:
    Caused by: org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.orm.jpa.vendor.EclipseLinkJpaV endorAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/PersistenceProvider

    I'm sure that the the bundle that export the org.eclipse.persistence.jpa is in bundle dependencies (org.eclipse.persistence.jpa).

    I use:
    Eclipse target (3.4.0);
    Spring DM 1.1.1;
    EclipseLink 1.0;

    Code:
    context.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns...>
    		
    	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
    		<property name="jpaVendorAdapter" ref="jpaAdapter"/>
    		<property name="persistenceUnitName" value="arena"/>
    	</bean>
    	
    	<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter" >
    		<property name="databasePlatform" value="org.eclipse.persistence.platform.database.PostgreSQLPlatform" />
    		<property name="showSql" value="true" />
    	</bean>
    	
    	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    		<property name="entityManagerFactory" ref="entityManagerFactory" />
    	</bean>
    	
    	<tx:annotation-driven transaction-manager="transactionManager"/> 
    	
    	<aop:config>
    		<aop:pointcut expression="execution(* ro.jtonic.test.services.IPersist+.*(..))" id="pc1"/>
    		<aop:advisor advice-ref="txAdvice" pointcut-ref="pc1" />
    	</aop:config>
    	
    	<tx:advice transaction-manager="transactionManager" id="txAdvice">
    		<tx:attributes>
    			<tx:method name="*"/>
    		</tx:attributes>
    	</tx:advice>
    	
    	<bean id="persist" class="ro.jtonic.test.services.Persist"/>
    	
    	<context:annotation-config/>
    	
    </beans>
    
    osgi-context.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans
       xmlns=...>
           
           <service ref="persist" id="persistService" interface="ro.jtonic.test.services.IPersist" />
    
    </beans:beans>   
    
    persistence.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns=...
    	version="1.0">
    	<persistence-unit name="arena" transaction-type="RESOURCE_LOCAL">
    		<provider>org.eclipse.persistence.jpa.PersistenceProvider
    		</provider>
    		<class>ro.jtonic.bvb.model.entities.Parent
    		</class>
    		<properties>
    			<property name="eclipselink.logging.level" value="INFO" />
    			<property name="eclipselink.jdbc.driver" value="org.postgresql.Driver" />
    			<property name="eclipselink.jdbc.url" value="jdbc:postgresql://localhost:5432/test" />
    			<property name="eclipselink.jdbc.password" value="test" />
    			<property name="eclipselink.jdbc.user" value="test" />
    			<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
    			<property name="jpa.showSql" value="true" />
    		</properties>
    	</persistence-unit>
    </persistence>
    
    and MANIFEST.MF:
    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-Name: Server Plug-in
    Bundle-SymbolicName: ro.jtonic.spring.server
    Bundle-Version: 1.0.0
    Bundle-Activator: ro.jtonic.spring.server.Activator
    Bundle-ActivationPolicy: lazy
    Bundle-RequiredExecutionEnvironment: JavaSE-1.6
    Import-Package: org.osgi.framework;version="1.3.0"
    Require-Bundle: org.springframework.osgi.extender;bundle-version="1.1.1",
     org.springframework.orm;bundle-version="2.5.5",
     ro.jtonic.postgresql.jdbc;bundle-version="8.3.603",
     com.springsource.org.aopalliance;bundle-version="1.0.0",
     com.springsource.org.apache.commons.logging;bundle-version="1.1.1",
     org.springframework.aop;bundle-version="2.5.5",
     org.springframework.beans;bundle-version="2.5.5",
     org.springframework.context;bundle-version="2.5.5",
     org.springframework.core;bundle-version="2.5.5",
     org.springframework.jdbc;bundle-version="2.5.5",
     org.springframework.osgi.core;bundle-version="1.1.1",
     org.springframework.osgi.io;bundle-version="1.1.1",
     org.springframework.transaction;bundle-version="2.5.5",
     javax.persistence,
     org.eclipse.persistence.jpa;bundle-version="1.0.0"
    Bundle-ClassPath: .
    What can I do against that NoClassDefFoundError exception?

    Thanks in advance, jtonic.

  • #2
    You need to also import the package not just export. Also make sure the import is in the bundle that require it - in many cases the import is required by a dependency and the problem is caused by a missing import (present in the root bundle) in the dependent bundle.
    What's your manifest?

    Comment

    Working...
    X