You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Ioannis Canellos (JIRA)" <ji...@apache.org> on 2011/09/05 22:22:09 UTC

[jira] [Commented] (CAMEL-4213) camel-jpa can't find entities when using blueprint in OSGi

    [ https://issues.apache.org/jira/browse/CAMEL-4213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13097313#comment-13097313 ] 

Ioannis Canellos commented on CAMEL-4213:
-----------------------------------------

@Claus: Indeed the TCCL is set (at least in the trunk) and its enough to properly load the classes, when using the blueprint. I did a test project using openjpa, aries jpa & camel-blueprint and I didn't have any issues (using the trunk). 


@Jonas: Can you try again using the trunk (version 2.9-SNAPSHOT)?

> camel-jpa can't find entities when using blueprint in OSGi
> ----------------------------------------------------------
>
>                 Key: CAMEL-4213
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4213
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa, osgi
>    Affects Versions: 2.7.2
>         Environment: Apache Karaf 2.2.2
>            Reporter: Jonas Bengtsson
>             Fix For: 2.9.0
>
>
> When using the following simple route, the entity classes can't be found:
> {code}
> public void configure() throws Exception {
>     from("direct:test-in").to("jpa:mypackage.MyEntity1");
>     from("jpa:mypackage.MyEntity2").to("log:test-out");
> }
> {code}
> The error message is:
> 09:43:55,417 | WARN  | rint Extender: 3 | ObjectHelper                     | g.apache.camel.util.ObjectHelper  698 | 78 - org.apache.camel.camel-core - 2.7.2 | Cannot find class: mypackage.MyEntity1
> 09:43:55,467 | WARN  | rint Extender: 3 | ObjectHelper                     | g.apache.camel.util.ObjectHelper  698 | 78 - org.apache.camel.camel-core - 2.7.2 | Cannot find class: mypackage.MyEntity2
> followed by many warnings about that the entityType is not known for the consumer.
> The errors only occur when using blueprint to bootstrap the route. When using spring-dm everything works fine. The entity classes are located in the same bundle as the route. My guess is that it uses the wrong classloader.
> JPA works fine otherwise. It is only the camel-jpa component I have problems with. camel-jpa is a very spring-centric module, using a spring TransactionManager and all, so I hope that my use case makes sense.
> For completeness here is my blueprint-file:
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> 	default-activation="eager" xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0">
> 	<camelContext xmlns="http://camel.apache.org/schema/blueprint">
> 		<package>mypackage</package>
> 	</camelContext>
> 	<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
> 		<property name="entityManagerFactory" ref="entityManagerFactory" />
> 		<property name="transactionManager" ref="transactionManager" />
> 	</bean>
> 	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
> 		<property name="entityManagerFactory" ref="entityManagerFactory" />
> 	</bean>
> 	<reference id="entityManagerFactory" interface="javax.persistence.EntityManagerFactory" filter="(osgi.unit.name=myunit)" />
> </blueprint>
> {code}
> The EntityManagerFactory is created by Aries Jpa, but it shouldn't be relevant for the question.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira