Camel JPA Idempotent + OSGI(Jboss Fuse)

时间:2017-05-17 21:52:15

标签: hibernate jpa apache-camel osgi jbossfuse

当我尝试在Fuse Fabric OSGI容器(fuse-karaf 6.3)中使用JPA Idempotent时,我遇到了问题。 我有这个例外:

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>

=============================================== =============

1 个答案:

答案 0 :(得分:0)

错误已确认并已解决

这个问题在Fuse 6.3中被确认为Bug并且已经解决了here,所以我改为使用幂等与camel-jdbc。