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
Spring DM + EclipseLink Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring DM + EclipseLink

    Hello,

    I want to use Spring DM and the Spring Framework with EclipseLink and eclipse RCP.
    I can use Spring DM and eclipse RCP, thats no Problem and I can use eclipse RCP + Eclipse, thats no Problem too.But both together doesn't work !!!

    I have ind the folder META-INF/spring this xml file
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    	xmlns:osgi="http://www.springframework.org/schema/osgi"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="
    	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
    	 
    	<context:annotation-config/>
    	
    	<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
    	
    	<!-- the DataSource (parameterized for configuration via a PropertyPlaceHolderConfigurer)  -->
        <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
            <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
            <property name="url" value="jdbc:derby:pp;create=true"/>
            <!--<property name="username" value="${jdbc.username}"/>
            <property name="password" value="${jdbc.password}"/>-->
        </bean>
        
    	<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
    	<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
    
    	 <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
    	     <property name="databasePlatform" value="org.eclipse.persistence.platform.database.DerbyPlatform" />
    	     <property name="showSql" value="true" />
    	</bean>
    
        <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
            <property name="dataSource" ref="dataSource" />
            <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
        </bean>
    	
        <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
            <property name="entityManagerFactory" ref="entityManagerFactory" />
            <property name="dataSource" ref="dataSource" />
        </bean>
    	
    	<osgi:reference id="test" interface="inter.KundenService" >
    	</osgi:reference>
    So and now i Start my RCP I get this Output
    Code:
    EVERE: Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=client, config=osgibundle:/META-INF/spring/*.xml))
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL [bundleentry://860.fwk10039797/META-INF/spring/client-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://860.fwk10039797/META-INF/spring/client-context.xml]: Cannot resolve reference to bean 'jpaVendorAdapter' while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter] for bean with name 'jpaVendorAdapter' defined in URL [bundleentry://860.fwk10039797/META-INF/spring/client-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter not found from bundle [client]
    Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter] for bean with name 'jpaVendorAdapter' defined in URL [bundleentry://860.fwk10039797/META-INF/spring/client-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter not found from bundle [client]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
    	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1004)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:542)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:486)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:336)
    	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
    	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://860.fwk10039797/META-INF/spring/client-context.xml]: Cannot resolve reference to bean 'jpaVendorAdapter' while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter] for bean with name 'jpaVendorAdapter' defined in URL [bundleentry://860.fwk10039797/META-INF/spring/client-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter not found from bundle [client]
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:385)
    	at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:266)
    	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:121)
    	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:77)
    	at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
    	at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:99)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1422)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1389)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
    	... 13 more
    What i have to do? If i import the package org.springframework.orm.jpa.vendor all my Bundle will be unsatisifed?!?!I dont know what to do?!

    Thanks for help =)
    Last edited by SirWayne; Feb 20th, 2010, 06:02 AM.

  • #2
    Ok I try it with Spring 3.0.1 A, but same result.
    If i import the package vendor I get a error in my Manifest.

    Comment


    • #3
      Wayne, I would recommend trying dmServer - or at least its samples which contain EclipseLink - ORMs under OSGi tend to be tricky due to lazy loading, dynamic class creation which conflict with the modularity boundaries imposed by OSGi.

      Comment


      • #4
        Thanks for your answer.
        But for what do I need the Spring DM Server?
        I have just a Application with eclipse RCP + Spring without Application Server.
        I want to do the Database connection over Spring with EclipseLink.
        1. Can I use Spring DM without Application Server?
        2. What do the Spring DM server?
        3. Is there a Tutorial how to integreate?

        Comment


        • #5
          What i have to do?
          I deploy my DAO and Services in the Spring DM Server?
          And how can my client use them? Do i have to do this
          http://static.springsource.org/sprin.../remoting.html HTTPInvoker for communication with my Eclipse RCP?

          Is there a solution without Application Server, because i have just a Application which runs on 1 pc.

          Comment


          • #6
            Hello,

            now i have this error
            Code:
            Mar 1, 2010 11:17:23 PM 
            INFO: Building JPA container EntityManagerFactory for persistence unit 'hello.jpa'
            [EL Config]: The access type for the persistent class [class internal.impl.KundeImpl] is set to [PROPERTY].
            [EL Config]: The alias name for the entity class [class internal.impl.KundeImpl] is being defaulted to: KundeImpl.
            [EL Config]: The table name for entity [class internal.impl.KundeImpl] is being defaulted to: KUNDEIMPL.
            [EL Config]: The column name for element [method getId] is being defaulted to: ID.
            [EL Config]: The column name for element [method getName] is being defaulted to: NAME.
            Mar 1, 2010 11:17:26 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
            INFO: Destroying singletons in 
            Mar 1, 2010 11:17:26 PM org.springframework.osgi.extender.internal.support.DefaultOsgiBundleApplicationContextListener onOsgiApplicationEvent
            SEVERE: Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=DBObjectTest.impl, config=osgibundle:/META-INF/spring/*.xml))
            org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL [bundleentry://1077.fwk3874616/META-INF/spring/db-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://1077.fwk3874616/META-INF/spring/db-context.xml]: Invocation of init method failed; nested exception is java.lang.reflect.UndeclaredThrowableException
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
                at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1044)
                at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:542)
                at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.registerBeanPostProcessors(AbstractDelegatedExecutionApplicationContext.java:486)
                at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:336)
                at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
                at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
                at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
                at java.lang.Thread.run(Unknown Source)
            Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://1077.fwk3874616/META-INF/spring/db-context.xml]: Invocation of init method failed; nested exception is java.lang.reflect.UndeclaredThrowableException
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
                at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:386)
                at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:266)
                at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139)
                at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79)
                at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
                at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:99)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1422)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1391)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
                ... 13 more
            Caused by: java.lang.reflect.UndeclaredThrowableException
                at $Proxy2.addTransformer(Unknown Source)
                at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:228)
                at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
                at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1400)
                ... 28 more
            Caused by: java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager$Jpa2PersistenceUnitInfoDecorator.invoke(DefaultPersistenceUnitManager.java:433)
                ... 34 more
            Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
                at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:109)
                ... 39 more
            Mar 1, 2010 11:17:42 PM org.springframework.osgi.extender.internal.activator.ContextLoaderListener shutdown
            INFO: Stopping [org.springframework.osgi.extender] bundle v.[1.2.1]
            Mar 1, 2010 11:17:42 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
            INFO: Destroying singletons in
            here is my current xml

            Code:
             <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
                
                <!-- the DataSource (parameterized for configuration via a PropertyPlaceHolderConfigurer)  -->
                <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
                    <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
                    <property name="url" value="jdbc:derby:pp;create=true"/>
                    <!--<property name="username" value="${jdbc.username}"/>
                    <property name="password" value="${jdbc.password}"/>-->
                </bean>
                
                <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
                <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
             
             
             
                <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                    <property name="dataSource" ref="dataSource" />
                    <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
                </bean>
             
                <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
                     <property name="databasePlatform" value="org.eclipse.persistence.platform.database.DerbyPlatform" />
                     <property name="showSql" value="true" />
                </bean>
                
                <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
                    <property name="entityManagerFactory" ref="entityManagerFactory" />
                    <property name="dataSource" ref="dataSource" />
                </bean>
            what is my mistake? How i can use LoadTimeWeaver??

            Comment


            • #7
              Ok now i try to use the LoadTimeWeaver

              Code:
              org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.weaving.AspectJWeavingEnabler#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [org.springframework.osgi.util.BundleDelegatingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
              	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
              	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
              	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
              	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
              	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
              	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
              	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
              	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
              	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
              	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
              	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
              	at java.lang.Thread.run(Unknown Source)
              Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [org.springframework.osgi.util.BundleDelegatingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
              	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
              	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
              	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
              	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
              	at org.springframework.context.weaving.LoadTimeWeaverAwareProcessor.postProcessBeforeInitialization(LoadTimeWeaverAwareProcessor.java:95)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1396)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
              	... 13 more
              Caused by: java.lang.IllegalStateException: ClassLoader [org.springframework.osgi.util.BundleDelegatingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar
              	at org.springframework.context.weaving.DefaultContextLoadTimeWeaver.setBeanClassLoader(DefaultContextLoadTimeWeaver.java:83)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1419)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1391)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
              	... 22 more
              Exception in thread "SpringOsgiExtenderThread-5" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.weaving.AspectJWeavingEnabler#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [org.springframework.osgi.util.BundleDelegatingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
              	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
              	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
              	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
              	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
              	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
              	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
              	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
              	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
              	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
              	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
              	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
              	at java.lang.Thread.run(Unknown Source)
              Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [org.springframework.osgi.util.BundleDelegatingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
              	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
              	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
              	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
              	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
              	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
              	at org.springframework.context.weaving.LoadTimeWeaverAwareProcessor.postProcessBeforeInitialization(LoadTimeWeaverAwareProcessor.java:95)
              	at org.springframework.bstart serviceeans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
              Code:
              <context:load-time-weaver aspectj-weaving="on"/>

              Comment


              • #8
                There's a blog post regarding load time weaving by Martin Lippert at
                http://martinlippert.blogspot.com/20...spring-dm.html

                This weaver works great for me.

                As for your original issue, importing the package containing the missing class should be the way to go, afaik. If this produces an unsatisfied dependency, maybe you are missing some bundle in your target platform?
                Unfortunately, the list of required bundles or package imports can become quite lengthy.

                This is the list of required bundles of one of my JPA-initializiation bundles:
                Code:
                Require-Bundle: org.eclipse.equinox.weaving.springweaver;bundle-version="0.1.0",
                 org.eclipse.persistence.core;bundle-version="2.0.0",
                 org.eclipse.persistence.jpa;bundle-version="2.0.0",
                 org.springframework.aop;bundle-version="3.0.0",
                 org.springframework.beans;bundle-version="3.0.0",
                 org.springframework.context;bundle-version="3.0.0",
                 org.springframework.core;bundle-version="3.0.0",
                 org.springframework.jdbc;bundle-version="3.0.0",
                 org.springframework.orm;bundle-version="3.0.0",
                 org.springframework.asm;bundle-version="3.0.0",
                 org.springframework.context.support;bundle-version="3.0.0",
                 org.springframework.expression;bundle-version="3.0.0",
                 org.springframework.aspects;bundle-version="3.0.0",
                 com.springsource.org.aspectj.runtime;bundle-version="1.6.8",
                 com.springsource.org.aspectj.weaver;bundle-version="1.6.8"
                The corresponding EntityManager configuration is very slim:
                Code:
                	<osgi:reference id="datasource" interface="javax.sql.DataSource"/>
                	
                	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                		<property name="dataSource" ref="datasource"/>
                	</bean>
                
                	<osgi:service ref="entityManagerFactory" interface="javax.persistence.EntityManagerFactory"/>
                The context is configured like this:
                Code:
                <annotation-config/>
                <component-scan base-package="mypackage" annotation-config="true" />
                <load-time-weaver weaver-class="org.eclipse.equinox.weaving.springweaver.EquinoxAspectsLoadTimeWeaver"/>

                Comment


                • #9
                  Thanks I have to do a try.=)
                  Do you use a Spring DM Server? Or only standalone client with JPA?

                  Comment


                  • #10
                    The example in this thread is from a Eclipse RCP based stand-alone application but if I had to guess, I'd say that it should work just the same way in DM server.

                    Comment


                    • #11
                      Originally posted by milgner View Post
                      The example in this thread is from a Eclipse RCP based stand-alone application but if I had to guess, I'd say that it should work just the same way in DM server.
                      thanks just what i was looking for. i will try it.

                      Comment


                      • #12
                        Okay i tried it:

                        My xml config is:
                        Code:
                        	<context:annotation-config />
                        	<context:load-time-weaver weaver-class="org.eclipse.equinox.weaving.springweaver.EquinoxAspectsLoadTimeWeaver"/>
                        	<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
                        
                        	<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
                        		<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
                        		<property name="url" value="jdbc:derby:kunde;create=true" />
                        	</bean>
                        
                        	<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
                        	<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
                        	
                        	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                        		<property name="dataSource" ref="dataSource"/>
                        	</bean>
                        	
                        	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
                        		<property name="entityManagerFactory" ref="entityManagerFactory" />
                        	</bean>
                        Almost it woks, only my EntityManager is always null:

                        Code:
                        public class DAO {
                        
                        	@PersistenceContext
                        	private EntityManager entityManager;
                        Any sugesstion?

                        Comment

                        Working...
                        X