[ https://issues.apache.org/jira/browse/CAMEL-4213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13098020#comment-13098020 ]
Willem Jiang commented on CAMEL-4213: ------------------------------------- This issue may be fixed by CAMEL-4347. > 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