JpaComponent Fails on doStart

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JpaComponent Fails on doStart

sekaijin
I'm trying to run JpaConsumer on servicemix 6
karaf 3.0.6 camel 2.16.2

The following features are installed
transaction                             | 1.1.1            | x         | enterprise-3.0.6               | OSGi Transaction Manager
spring-tx                               | 3.2.14.RELEASE_1 | x         | spring-3.0.6                   | Spring 3.2.x Transaction (TX) support
spring-tx                               | 4.2.4.RELEASE_1  | x         | spring-3.0.6
openjpa                                 | 2.3.0            | x         | enterprise-3.0.6
camel-jpa                               | 2.16.2           | x         | camel-2.16.2


 the doStart of JpaComponent fails with the error:

because of Failed to resolve endpoint: jpa://....&joinTransaction=false due to: Cannot auto create component: jpa

....

Caused by: org.apache.camel.RuntimeCamelException: java.lang.ClassCastException: Cannot cast org.apache.aries.transaction.internal.AriesPlatformTransactionManager to org.springframework.transaction.PlatformTransactionManager
        at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1642)
        at org.apache.camel.core.osgi.OsgiServiceRegistry.findByTypeWithName(OsgiServiceRegistry.java:115)
        at org.apache.camel.impl.CompositeRegistry.findByTypeWithName(CompositeRegistry.java:91)
        at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.findByTypeWithName(PropertyPlaceholderDelegateRegistry.java:70)
        at org.apache.camel.component.jpa.JpaComponent.doStart(JpaComponent.java:139)
        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3232)
        at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:407)
        ... 71 more
Caused by: java.lang.ClassCastException: Cannot cast org.apache.aries.transaction.internal.AriesPlatformTransactionManager to org.springframework.transaction.PlatformTransactionManager
        at java.lang.Class.cast(Unknown Source)[:1.8.0_102]
        at org.apache.camel.core.osgi.OsgiServiceRegistry.findByTypeWithName(OsgiServiceRegistry.java:107)


camel-jpa feature (2.16.2) install  spring 3.2.14.RELEASE_1
camel-jpa bundle import
org.springframework.orm.jpa;version="[3.2,5)",
org.springframework.transaction;version="[3.2,5)",
org.springframework.transaction.support;version="[3.2,5)"

This is consistent with the feature

but the source code of camel-jpa dépend on spring-orm 4.1.9.RELEASE

Please, help me
A+JYT
Reply | Threaded
Open this post in threaded view
|

Re: JpaComponent Fails on doStart

Ranx
Is there a reason to have both of the spring-tx bundles in there? I haven't looked in the two Spring bundles you have listed here but my guess, based on the "wrap" mention in the stack trace, is that the two bundles are not created with OSGi manifests so you may be getting a race condition on classloading. That's a wild ass guess so don't hold me to that. But first I'd look to see if you need both of those spring transaction managers and also look at the manifests in the jar/bundles to see if they are OSGi.

There's obviously a mismatch in the Aries bundle and the Spring Bundle that is being used
org.apache.aries.transaction.internal.AriesPlatformTransactionManager to org.springframework.transaction.PlatformTransactionManager

OSGi should be able to handle the different major versions but it appears something is wrong in that regard.

spring-tx                               | 3.2.14.RELEASE_1 | x         | spring-3.0.6                   | Spring 3.2.x Transaction (TX) support
spring-tx                               | 4.2.4.RELEASE_1  | x         | spring-3.0.6
Reply | Threaded
Open this post in threaded view
|

Re: JpaComponent Fails on doStart

ksobkowiak
In reply to this post by sekaijin
Hi

Could you give us more details how to reproduce the problem? I assume you use ServiceMix 6.1.1. I could successfully install camel-jpa and openjpa features.

karaf@root>feature:install camel-jpa openjpa
Refreshing bundles org.apache.servicemix.bundles.spring-core (83), org.apache.servicemix.bundles.spring-context-support (88), org.apache.servicemix.bundles.spring-context (87)

There is also only one transaction bundle installed

karaf@root>list -t 0 | grep tx
138 | Active   |  30 | 3.2.14.RELEASE_1                   | Apache ServiceMix :: Bundles :: spring-tx

Kindly regards
Krzysztof

On 8/21/17 5:12 PM, sekaijin wrote:

> I'm trying to run JpaConsumer on servicemix 6
> karaf 3.0.6 camel 2.16.2
>
> The following features are installed
>
>
>
>  the doStart of JpaComponent fails with the error:
>
>
>
>
> camel-jpa feature (2.16.2) install  spring *3.2.14.RELEASE_1*
> camel-jpa bundle import
> org.springframework.orm.jpa;version="[3.2,5)",
> org.springframework.transaction;version="[3.2,5)",
> org.springframework.transaction.support;version="[3.2,5)"
>
> This is consistent with the feature
>
> but the source code of camel-jpa dépend on spring-orm *4.1.9.RELEASE*
>
> Please, help me
> A+JYT
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/JpaComponent-Fails-on-doStart-tp5725026.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

--
Krzysztof Sobkowiak (@ksobkowiak)

JEE & OSS Architect, Integration Architect
Apache Software Foundation Member (http://apache.org/)
Apache ServiceMix Committer & PMC Member (http://servicemix.apache.org/)
Senior Solution Architect @ Capgemini SSC (http://www.capgeminisoftware.pl/)