Я пытаюсь использовать JPA для сохранения объекта в базе данных с помощью Camel.
У меня есть файл persistence.xml следующим образом:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="my-pu">
<description>My Persistence Unit</description>
<class>org.bencompany.camel.JabberMessage</class>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<properties>
<property name="openjpa.ConnectionURL" value="mysql://localhost/jabber"/>
<property name="openjpa.ConnectionDriverName" value="org.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.password" value="root"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
<property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
</properties>
</persistence-unit>
</persistence>
и мой верблюд/бобы .xml таков:
<?xml version="1.0"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="my-pu" />
</bean>
<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="myProcessor" class="org.bencompany.camel.JabberProcessor" />
<camelContext xmlns="http://camel.apache.org/schema/blueprint"
xmlns:order="http://fusesource.com/examples/order/v7" id="cbr-example-context">
<route id="sendMessage">
<from uri="file:work/cbr/input" />
<log message="Sending Message: ${body}" />
<to uri="xmpp://[email protected]/[email protected]&password=xx&nickname=bencamelbot" />
</route>
<route id="recieveMessage">
<from uri="xmpp://[email protected]/[email protected]&password=xx&nickname=bencamelbot" />
<to uri="myProcessor" />
<to uri="jpa://" />
</route>
</camelContext>
</blueprint>
Я использую Blueprint, поскольку пытаюсь развернуть это на JBoss Fuse. Я использовал следующую ссылку в качестве справки и перешел по ней до тройника: https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/EIP_Component_Reference/files/_IDU_JPA.html
Но когда я пытаюсь развернуть свое приложение, я получаю эту ошибку.
org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: entityManagerFactory, getter: class org.apache.camel.component.jpa.JpaComponent.getEntityManagerFactory(), setter: [class org.apache.camel.component.jpa.JpaComponent.setEntityManagerF
actory(interface javax.persistence.EntityManagerFactory)]
Caused by: java.lang.Exception: Unable to convert value org.springframework.orm.jpa.LocalEntityManagerFactoryBean@3ce0f4c8 to type javax.persistence.EntityManagerFactory
Предполагается, что LocalEntityManagerFactoryBean создает EntityManagerFactory, и я делаю именно то, что говорится в документации JBoss/Camel, но возникает эта ошибка.
Есть идеи?