Spring ServiceMix/JPA集成-LocalContainerEntityManagerFactoryBean以键入EntityManagerFactory

Spring ServiceMix/JPA集成-LocalContainerEntityManagerFactoryBean以键入EntityManagerFactory,spring,jpa,apache-camel,apache-servicemix,Spring,Jpa,Apache Camel,Apache Servicemix,我对ServiceMix/JPA/Camel/Spring相当陌生。我正在尝试使用camel jpa组件作为camel路线的一部分。我使用的是ServiceMix的最新版本,即4.5.1。这将使用camel 2.10.4和spring 3.0.7 在更新OSGi清单并将一些附加模块部署到servicemix之后,我陷入了以下堆栈跟踪: org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting

我对ServiceMix/JPA/Camel/Spring相当陌生。我正在尝试使用camel jpa组件作为camel路线的一部分。我使用的是ServiceMix的最新版本,即4.5.1。这将使用camel 2.10.4和spring 3.0.7

在更新OSGi清单并将一些附加模块部署到servicemix之后,我陷入了以下堆栈跟踪:

org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: entityManagerFactory, getter: class org.springframework.orm.jpa.JpaTransactionManager.getEntityManagerFactory(, setter: [class org.springframework.orm.jpa.JpaTransactionManager.setEntityManagerFactory(interface javax.persistence.EntityManagerFactory]
[...]
Caused by: java.lang.Exception: Unable to convert value org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@46e9e26a to type javax.persistence.EntityManagerFactory
at org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:172)[10:org.apache.aries.blueprint:0.3.2]
at org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:373)[10:org.apache.aries.blueprint:0.3.2]
at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:322)[10:org.apache.aries.blueprint:0.3.2]
at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:555)[10:org.apache.aries.blueprint:0.3.2]
at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:306)[10:org.apache.aries.blueprint:0.3.2]
at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:819)[10:org.apache.aries.blueprint:0.3.2]

org.osgi.service.blueprint.container.ComponentDefinitionException:设置属性时出错:PropertyDescriptor,因为您已经使用了使用Aries JPA和JTA功能的blueprint。
为此,您还需要安装这些功能(JPA/JTA),并确保您的事务是JTA类型的,使用Aries的实体管理器而不是spring,您应该是安全的。DAO看起来更像如下所示:

<bean id="daoBean" class="dummy.class.name.DaoBean">
   <jpa:context property="em" unitname="customer1" />
   <tx:transaction method="*" value="Required" />
</bean>


要使其正常工作,您需要参考相应的蓝图模式

这以及一些额外的资源帮助我理解了如何使用Blueprint/Aries JPA特性。我已经克服了这一错误,但现在仍停留在IllegalArgumentException上。我在以下位置创建了一个单独的线程:
<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_2_0.xsd"
         version="2.0">
<persistence-unit name="customer1" transaction-type="RESOURCE_LOCAL">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <class>....</class>
</persistence-unit>
<bean id="daoBean" class="dummy.class.name.DaoBean">
   <jpa:context property="em" unitname="customer1" />
   <tx:transaction method="*" value="Required" />
</bean>