Details
Description
When using the following simple route, the entity classes can't be found:
public void configure() throws Exception { from("direct:test-in").to("jpa:mypackage.MyEntity1"); from("jpa:mypackage.MyEntity2").to("log:test-out"); }
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:
<?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>
The EntityManagerFactory is created by Aries Jpa, but it shouldn't be relevant for the question.