You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Charles Moulliard <cm...@gmail.com> on 2009/12/16 17:03:11 UTC

Cannot convert value of type [org.springframework.orm.jpa.JpaTransactionManager] to required type [javax.transaction.TransactionManager] - SMX4/Karaf

Hi,

I try to config a JPA project with Spring top of SMX4/Karaf but when spring
context is loaded, the following error is generated :

Caused by: org.springframework.beans.TypeMismatchException: Failed to
convert property value of type
[org.springframework.orm.jpa.JpaTransactionManager] to required type
[javax.transaction.TransactionManager] for property 'transactionManager';
nested exception is java.lang.IllegalArgumentException: Cannot convert value
of type [org.springframework.orm.jpa.JpaTransactionManager] to required type
[javax.transaction.TransactionManager] for property 'transactionManager': no
matching editors or conversion strategy found
    at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    ... 16 more
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type
[org.springframework.orm.jpa.JpaTransactionManager] to required type
[javax.transaction.TransactionManager] for property 'transactionManager': no
matching editors or conversion strategy found
    at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
    at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
    at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)

    <bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="report" />
        <property name="jpaVendorAdapter" ref="jpaAdapter" />
    </bean>

    <!-- EclipseLink addapter -->
    <bean id="jpaAdapter"

class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
        <property name="databasePlatform"
            value="org.eclipse.persistence.platform.database.DerbyPlatform"
/>
        <property name="database" value="DERBY" />
    </bean>

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName"
value="org.apache.derby.jdbc.EmbeddedDriver" />
        <property name="url"
            value="jdbc:derby://localhost:1527/report;create=true" />
        <property name="username" value="sa" />
        <property name="password" value="" />
    </bean>

Does anybody knows how to avoid this error ?

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm

Re: Cannot convert value of type [org.springframework.orm.jpa.JpaTransactionManager] to required type [javax.transaction.TransactionManager] - SMX4/Karaf

Posted by Charles Moulliard <cm...@gmail.com>.
Hi Gert,

What is really strange is that the following config works when deployed in
Karaf / SMX4

    <bean id="transactionTemplate"
        class="org.springframework.transaction.support.TransactionTemplate">
        <property name="transactionManager">
            <bean class="org.springframework.orm.jpa.JpaTransactionManager">
                <property name="entityManagerFactory"
ref="entityManagerFactory" />
            </bean>
        </property>
    </bean>

    <bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="camel" />
        <property name="jpaVendorAdapter" ref="jpaAdapter" />
    </bean>

    <!-- EclipseLink addapter -->
    <bean id="jpaAdapter"
class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
        <property name="databasePlatform"
value="org.eclipse.persistence.platform.database.HSQLPlatform" />
        <property name="database" value="HSQL" />
    </bean>

The only difference concern the TransactionTemplate and JpaTemplate which
are used in example camel-example-etl

Regards,


Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Dec 16, 2009 at 8:21 PM, Gert Vanthienen
<ge...@gmail.com>wrote:

> Charles,
>
> I don't think the org.springframework.orm.jpa.JpaTransactionManager
> actually implements the javax.transaction.TransactionManager
> interface.  Not sure where you're trying to inject the interface (I
> don't see a bean that gets this object injected in it), but if you
> need access to that JpaTransactionManager, you probably want to refer
> to it using the
> org.springframework.transaction.PlatformTransactionManager interface.
>
> Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
>
> 2009/12/16 Charles Moulliard <cm...@gmail.com>:
> > Hi,
> >
> > I try to config a JPA project with Spring top of SMX4/Karaf but when
> spring
> > context is loaded, the following error is generated :
> >
> > Caused by: org.springframework.beans.TypeMismatchException: Failed to
> > convert property value of type
> > [org.springframework.orm.jpa.JpaTransactionManager] to required type
> > [javax.transaction.TransactionManager] for property 'transactionManager';
> > nested exception is java.lang.IllegalArgumentException: Cannot convert
> value
> > of type [org.springframework.orm.jpa.JpaTransactionManager] to required
> type
> > [javax.transaction.TransactionManager] for property 'transactionManager':
> no
> > matching editors or conversion strategy found
> >    at
> >
> org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
> >    at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
> >    at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
> >    at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
> >    at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
> >    ... 16 more
> > Caused by: java.lang.IllegalArgumentException: Cannot convert value of
> type
> > [org.springframework.orm.jpa.JpaTransactionManager] to required type
> > [javax.transaction.TransactionManager] for property 'transactionManager':
> no
> > matching editors or conversion strategy found
> >    at
> >
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
> >    at
> >
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
> >    at
> >
> org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
> >
> >    <bean id="transactionManager"
> > class="org.springframework.orm.jpa.JpaTransactionManager">
> >        <property name="entityManagerFactory" ref="entityManagerFactory"
> />
> >    </bean>
> >
> >    <bean id="entityManagerFactory"
> >        class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
> >        <property name="persistenceUnitName" value="report" />
> >        <property name="jpaVendorAdapter" ref="jpaAdapter" />
> >    </bean>
> >
> >    <!-- EclipseLink addapter -->
> >    <bean id="jpaAdapter"
> >
> > class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
> >        <property name="databasePlatform"
> >
>  value="org.eclipse.persistence.platform.database.DerbyPlatform"
> > />
> >        <property name="database" value="DERBY" />
> >    </bean>
> >
> >    <bean id="dataSource"
> >
>  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> >        <property name="driverClassName"
> > value="org.apache.derby.jdbc.EmbeddedDriver" />
> >        <property name="url"
> >            value="jdbc:derby://localhost:1527/report;create=true" />
> >        <property name="username" value="sa" />
> >        <property name="password" value="" />
> >    </bean>
> >
> > Does anybody knows how to avoid this error ?
> >
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> > twitter : http://twitter.com/cmoulliard
> > Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >
> > Apache Camel Group :
> > http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >
>

Re: Cannot convert value of type [org.springframework.orm.jpa.JpaTransactionManager] to required type [javax.transaction.TransactionManager] - SMX4/Karaf

Posted by Charles Moulliard <cm...@gmail.com>.
I have found the solution.

Adding this line in spring bean file

<context:load-time-weaver
weaver-class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Thu, Dec 17, 2009 at 1:51 PM, Charles Moulliard <cm...@gmail.com>wrote:

> Gert,
>
> I have found the issue of my problem. My spring config file was deployed in
> the bundle containing activemq + transaction spring config file.
> When moving my config to another bundle, the problem is solved.
>
> I'm now faced to the following problem described here :
>
> Link explaning the problem :: https://fusesource.com/forums/thread.jspa?messageID=4290
>
>
> java.lang.IllegalStateException: Must start with Java agent to use
> InstrumentationLoadTimeWeaver.
>
> Any idea how to solve it ?
>
> 13:41:35,835 | ERROR | ExtenderThread-8 | ContextLoaderListener            | BundleApplicationContextListener   50 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.dao, config=osgibundle:/META-INF/spring/*.xml))
>
> org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundle://133.0:0/META-INF/spring/derby-datasource.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.
>
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
>
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>
> 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
> 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
>
> 	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:136)
> 	at java.lang.Thread.run(Thread.java:619)
>
> Caused by: java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.
> 	at org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver.addTransformer(InstrumentationLoadTimeWeaver.java:88)
>
> 	at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:80)
>
>
> Regards,
>
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>
>
> On Wed, Dec 16, 2009 at 8:21 PM, Gert Vanthienen <
> gert.vanthienen@gmail.com> wrote:
>
>> Charles,
>>
>> I don't think the org.springframework.orm.jpa.JpaTransactionManager
>> actually implements the javax.transaction.TransactionManager
>> interface.  Not sure where you're trying to inject the interface (I
>> don't see a bean that gets this object injected in it), but if you
>> need access to that JpaTransactionManager, you probably want to refer
>> to it using the
>> org.springframework.transaction.PlatformTransactionManager interface.
>>
>> Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>>
>> 2009/12/16 Charles Moulliard <cm...@gmail.com>:
>> > Hi,
>> >
>> > I try to config a JPA project with Spring top of SMX4/Karaf but when
>> spring
>> > context is loaded, the following error is generated :
>> >
>> > Caused by: org.springframework.beans.TypeMismatchException: Failed to
>> > convert property value of type
>> > [org.springframework.orm.jpa.JpaTransactionManager] to required type
>> > [javax.transaction.TransactionManager] for property
>> 'transactionManager';
>> > nested exception is java.lang.IllegalArgumentException: Cannot convert
>> value
>> > of type [org.springframework.orm.jpa.JpaTransactionManager] to required
>> type
>> > [javax.transaction.TransactionManager] for property
>> 'transactionManager': no
>> > matching editors or conversion strategy found
>> >    at
>> >
>> org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
>> >    at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
>> >    at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
>> >    at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
>> >    at
>> >
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
>> >    ... 16 more
>> > Caused by: java.lang.IllegalArgumentException: Cannot convert value of
>> type
>> > [org.springframework.orm.jpa.JpaTransactionManager] to required type
>> > [javax.transaction.TransactionManager] for property
>> 'transactionManager': no
>> > matching editors or conversion strategy found
>> >    at
>> >
>> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
>> >    at
>> >
>> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
>> >    at
>> >
>> org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
>> >
>> >    <bean id="transactionManager"
>> > class="org.springframework.orm.jpa.JpaTransactionManager">
>> >        <property name="entityManagerFactory" ref="entityManagerFactory"
>> />
>> >    </bean>
>> >
>> >    <bean id="entityManagerFactory"
>> >
>>  class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
>> >        <property name="persistenceUnitName" value="report" />
>> >        <property name="jpaVendorAdapter" ref="jpaAdapter" />
>> >    </bean>
>> >
>> >    <!-- EclipseLink addapter -->
>> >    <bean id="jpaAdapter"
>> >
>> > class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
>> >        <property name="databasePlatform"
>> >
>>  value="org.eclipse.persistence.platform.database.DerbyPlatform"
>> > />
>> >        <property name="database" value="DERBY" />
>> >    </bean>
>> >
>> >    <bean id="dataSource"
>> >
>>  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>> >        <property name="driverClassName"
>> > value="org.apache.derby.jdbc.EmbeddedDriver" />
>> >        <property name="url"
>> >            value="jdbc:derby://localhost:1527/report;create=true" />
>> >        <property name="username" value="sa" />
>> >        <property name="password" value="" />
>> >    </bean>
>> >
>> > Does anybody knows how to avoid this error ?
>> >
>> > Regards,
>> >
>> > Charles Moulliard
>> > Senior Enterprise Architect
>> > Apache Camel Committer
>> >
>> > *****************************
>> > blog : http://cmoulliard.blogspot.com
>> > twitter : http://twitter.com/cmoulliard
>> > Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>> >
>> > Apache Camel Group :
>> > http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>> >
>>
>
>

Re: Cannot convert value of type [org.springframework.orm.jpa.JpaTransactionManager] to required type [javax.transaction.TransactionManager] - SMX4/Karaf

Posted by Charles Moulliard <cm...@gmail.com>.
Gert,

I have found the issue of my problem. My spring config file was deployed in
the bundle containing activemq + transaction spring config file.
When moving my config to another bundle, the problem is solved.

I'm now faced to the following problem described here :

Link explaning the problem ::
https://fusesource.com/forums/thread.jspa?messageID=4290


java.lang.IllegalStateException: Must start with Java agent to use
InstrumentationLoadTimeWeaver.

Any idea how to solve it ?

13:41:35,835 | ERROR | ExtenderThread-8 | ContextLoaderListener
    | BundleApplicationContextListener   50 | Application context
refresh failed (OsgiBundleXmlApplicationContext(bundle=org.apache.camel.example.reportincident.restful.dao,
config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in URL
[bundle://133.0:0/META-INF/spring/derby-datasource.xml]: Invocation of
init method failed; nested exception is
java.lang.IllegalStateException: Must start with Java agent to use
InstrumentationLoadTimeWeaver. See Spring documentation.
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
	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:136)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: Must start with Java agent
to use InstrumentationLoadTimeWeaver. See Spring documentation.
	at org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver.addTransformer(InstrumentationLoadTimeWeaver.java:88)
	at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:80)


Regards,


Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Dec 16, 2009 at 8:21 PM, Gert Vanthienen
<ge...@gmail.com>wrote:

> Charles,
>
> I don't think the org.springframework.orm.jpa.JpaTransactionManager
> actually implements the javax.transaction.TransactionManager
> interface.  Not sure where you're trying to inject the interface (I
> don't see a bean that gets this object injected in it), but if you
> need access to that JpaTransactionManager, you probably want to refer
> to it using the
> org.springframework.transaction.PlatformTransactionManager interface.
>
> Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
>
> 2009/12/16 Charles Moulliard <cm...@gmail.com>:
> > Hi,
> >
> > I try to config a JPA project with Spring top of SMX4/Karaf but when
> spring
> > context is loaded, the following error is generated :
> >
> > Caused by: org.springframework.beans.TypeMismatchException: Failed to
> > convert property value of type
> > [org.springframework.orm.jpa.JpaTransactionManager] to required type
> > [javax.transaction.TransactionManager] for property 'transactionManager';
> > nested exception is java.lang.IllegalArgumentException: Cannot convert
> value
> > of type [org.springframework.orm.jpa.JpaTransactionManager] to required
> type
> > [javax.transaction.TransactionManager] for property 'transactionManager':
> no
> > matching editors or conversion strategy found
> >    at
> >
> org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
> >    at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
> >    at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
> >    at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
> >    at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
> >    ... 16 more
> > Caused by: java.lang.IllegalArgumentException: Cannot convert value of
> type
> > [org.springframework.orm.jpa.JpaTransactionManager] to required type
> > [javax.transaction.TransactionManager] for property 'transactionManager':
> no
> > matching editors or conversion strategy found
> >    at
> >
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
> >    at
> >
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
> >    at
> >
> org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
> >
> >    <bean id="transactionManager"
> > class="org.springframework.orm.jpa.JpaTransactionManager">
> >        <property name="entityManagerFactory" ref="entityManagerFactory"
> />
> >    </bean>
> >
> >    <bean id="entityManagerFactory"
> >        class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
> >        <property name="persistenceUnitName" value="report" />
> >        <property name="jpaVendorAdapter" ref="jpaAdapter" />
> >    </bean>
> >
> >    <!-- EclipseLink addapter -->
> >    <bean id="jpaAdapter"
> >
> > class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
> >        <property name="databasePlatform"
> >
>  value="org.eclipse.persistence.platform.database.DerbyPlatform"
> > />
> >        <property name="database" value="DERBY" />
> >    </bean>
> >
> >    <bean id="dataSource"
> >
>  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> >        <property name="driverClassName"
> > value="org.apache.derby.jdbc.EmbeddedDriver" />
> >        <property name="url"
> >            value="jdbc:derby://localhost:1527/report;create=true" />
> >        <property name="username" value="sa" />
> >        <property name="password" value="" />
> >    </bean>
> >
> > Does anybody knows how to avoid this error ?
> >
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> > twitter : http://twitter.com/cmoulliard
> > Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >
> > Apache Camel Group :
> > http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >
>

Re: Cannot convert value of type [org.springframework.orm.jpa.JpaTransactionManager] to required type [javax.transaction.TransactionManager] - SMX4/Karaf

Posted by Gert Vanthienen <ge...@gmail.com>.
Charles,

I don't think the org.springframework.orm.jpa.JpaTransactionManager
actually implements the javax.transaction.TransactionManager
interface.  Not sure where you're trying to inject the interface (I
don't see a bean that gets this object injected in it), but if you
need access to that JpaTransactionManager, you probably want to refer
to it using the
org.springframework.transaction.PlatformTransactionManager interface.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/12/16 Charles Moulliard <cm...@gmail.com>:
> Hi,
>
> I try to config a JPA project with Spring top of SMX4/Karaf but when spring
> context is loaded, the following error is generated :
>
> Caused by: org.springframework.beans.TypeMismatchException: Failed to
> convert property value of type
> [org.springframework.orm.jpa.JpaTransactionManager] to required type
> [javax.transaction.TransactionManager] for property 'transactionManager';
> nested exception is java.lang.IllegalArgumentException: Cannot convert value
> of type [org.springframework.orm.jpa.JpaTransactionManager] to required type
> [javax.transaction.TransactionManager] for property 'transactionManager': no
> matching editors or conversion strategy found
>    at
> org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
>    ... 16 more
> Caused by: java.lang.IllegalArgumentException: Cannot convert value of type
> [org.springframework.orm.jpa.JpaTransactionManager] to required type
> [javax.transaction.TransactionManager] for property 'transactionManager': no
> matching editors or conversion strategy found
>    at
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
>    at
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
>    at
> org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
>
>    <bean id="transactionManager"
> class="org.springframework.orm.jpa.JpaTransactionManager">
>        <property name="entityManagerFactory" ref="entityManagerFactory" />
>    </bean>
>
>    <bean id="entityManagerFactory"
>        class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
>        <property name="persistenceUnitName" value="report" />
>        <property name="jpaVendorAdapter" ref="jpaAdapter" />
>    </bean>
>
>    <!-- EclipseLink addapter -->
>    <bean id="jpaAdapter"
>
> class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
>        <property name="databasePlatform"
>            value="org.eclipse.persistence.platform.database.DerbyPlatform"
> />
>        <property name="database" value="DERBY" />
>    </bean>
>
>    <bean id="dataSource"
>        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>        <property name="driverClassName"
> value="org.apache.derby.jdbc.EmbeddedDriver" />
>        <property name="url"
>            value="jdbc:derby://localhost:1527/report;create=true" />
>        <property name="username" value="sa" />
>        <property name="password" value="" />
>    </bean>
>
> Does anybody knows how to avoid this error ?
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>