Caused by: java.lang.ClassNotFoundException: org.hibernate.proxy.HibernateProxy not found by org.apache.camel.camel-jpa [121]
我用示例创建了一个简单的项目:camel-jpa-idempotent
from("jpa:com.mycompany.model.Client?persistenceUnit=persistenceUnit&consumeDelete=false")
.split().simple("${body}")
.idempotentConsumer(simple("${body.id}/${body.name}"), JpaMessageIdRepository.jpaMessageIdRepository("persistenceUnit", "ClientRepository"))
.log("${body.name} processed");
========================================
<osgix:cm-properties id="parametros.spring" persistent-id="parametros.spring">
<prop key="db.driverClassName">org.postgresql.Driver</prop>
<prop key="db.url">jdbc:postgresql://192.168.238.1:5432/camel-jpa
</prop>
<prop key="db.username">camel-jpa</prop>
<prop key="db.password">123456</prop>
</osgix:cm-properties>
<ctx:property-placeholder properties-ref="parametros.spring"/>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${db.driverClassName}" />
<property name="url" value="${db.url}" />
<property name="username" value="${db.username}" />
<property name="password" value="${db.password}" />
</bean>
<bean class="com.mycompany.routes.CamelRoute" id="javaCamelRoute"/>
<bean class="org.apache.camel.component.jpa.JpaComponent" id="jpa">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
<property name="transactionManager" ref="jpaTxManager"/>
</bean>
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="jpaTxManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="persistenceUnit"/>
<property name="dataSource" ref="dataSource"/>
</bean>
<camelContext id="amq-example-context"
xmlns="http://camel.apache.org/schema/spring" xmlns:order="http://com.mycompany/examples/order">
<propertyPlaceholder id="properties" location="ref:parametros.spring"/>
<routeBuilder ref="javaCamelRoute"/>
</camelContext>
=============================================== =============