Camel Jpa Hibernate 属性 在 Karaf 容器中重新启动包后访问异常
Camel Jpa Hibernate Property access exception After bundle restart in Karaf Container
对 JPA 相当陌生,我有一个使用它的骆驼路线,所以我无法准确理解我的问题是什么以及如何解决它。经过更多测试后,我开始意识到这个错误似乎只在我的 karaf 容器中重新启动我的包后才会发生。如果我第一次加载容器并安装它,一切似乎 运行 都很好。我添加了我的特征文件信息
Version information:
JBoss 6.2.1
Camel Version: 2.15.1.redhat-621084
Hibernate Version: 4.2.20.Final-redhat-1
from(exceptionInputQueue).routeId("PackageExceptionRoute")
.unmarshal(exceptionDataFormat).id("UnmarshalException")
.convertBodyTo(ExceptionEntity.class).id("ExceptionModelToEntity")
.to("jpa:" + ExceptionEntity.class.getName()).id("PersistExceptionEntity");
@Entity
@Table(name = "Exception")
public class ExceptionEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "PackageTrackingNumber", updatable = false, nullable = false, length = 18)
private String packageTrackingNumber;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "ExceptionTimestamp")
private Date exceptionTimestamp;
@Column(name = "InformationSourceCode", length = 2)
private String informationSourceCode;
@Column(name = "ExceptionReasonCode", length = 2)
private String exceptionReasonCode;
@Column(name = "ExceptionResolutionCode", length = 2)
private String exceptionResolutionCode;
@Column(name = "ExceptionStatusCode", length = 2)
private String exceptionStatusCode;
@Column(name = "ExceptionCountryCode", length = 2)
private String exceptionCountryCode;
@Column(name = "ExceptionLocationNumber", length = 5)
private String exceptionLocationNumber;
//... hashcode, equals, toString, and getters/setters excluded
}
骆驼语境
<camelContext id="PackageExceptionRouteContext" xmlns="http://camel.apache.org/schema/spring"
streamCache="true">
<routeBuilder ref="PackageExceptionRoute" />
</camelContext>
<bean id="PackageExceptionRoute" class="com.ups.ops.cipe.internal.route.PackageExceptionRoute">
<property name="exceptionInputQueue" value="ibmmq:queue:myQueueName" />
<property name="exceptionDataFormat" ref="GsonDataFormat" />
</bean>
<bean id="GsonDataFormat" class="org.apache.camel.component.gson.GsonDataFormat">
<property name="unmarshalType"
value="com.ups.ops.cipe.internal.eud.model.EudExceptionModel" />
<property name="dateFormatPattern" value="yyyy-MM-dd' 'HH:mm:ss.SSS' 'X" />
</bean>
<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="transactionManager" ref="transactionManager" />
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="PackageException" />
<property name="jpaVendorAdapter" ref="jpaAdapter" />
<property name="jpaDialect" ref="jpaDialect" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="generateDdl" value="true" />
<property name="showSql" value="false" />
<property name="database" value="SQL_SERVER" />
<property name="databasePlatform" value="org.hibernate.dialect.SQLServer2012Dialect" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="dataSource" />
<property name="jpaDialect" ref="jpaDialect" />
</bean>
<bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
<bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="myDBURL" />
<property name="username" value="myUser" />
<property name="password" value="myPass" />
</bean>
<bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
<property name="transactionManager" ref="transactionManager" />
</bean>
<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent"
destroy-method="doStop">
<property name="transacted" value="false" />
<property name="concurrentConsumers" value="1" />
<property name="maxConcurrentConsumers" value="1" />
<property name="acceptMessagesWhileStopping" value="true" />
<property name="acknowledgementModeName" value="CLIENT_ACKNOWLEDGE" />
<property name="cacheLevelName" value="CACHE_CONSUMER" />
<property name="connectionFactory">
<bean class="org.springframework.jms.connection.SingleConnectionFactory"
destroy-method="destroy">
<constructor-arg>
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1" />
<property name="channel" value="myChannel" />
<property name="hostName" value="myHostname" />
<property name="port" value="myPort" />
<property name="queueManager" value="myQueueManager" />
</bean>
</constructor-arg>
</bean>
</property>
</bean>
Persistence.xml
<persistence-unit name="PackageException" transaction-type="RESOURCE_LOCAL">
<class>com.ups.ops.cipe.external.exception.entity.ExceptionEntity</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServer2012Dialect" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
专题文件
<feature name="myFeature-all" version="${project.version}">
<feature>camel-gson</feature>
<feature>camel-quartz</feature>
<feature>camel-jpa</feature>
<feature>camel-jgroups</feature>
<feature>hibernate</feature>
<bundle>mvn:com.fun.my.project/PackageExceptionBundle/${project.version}</bundle>
</feature>
堆栈跟踪
javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.ups.ops.cipe.external.exception.entity.ExceptionEntity.packageTrackingNumber
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:898)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_66]
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:366)[261:org.apache.servicemix.bundles.spring-orm:3.2.12.RELEASE_2]
at com.sun.proxy.$Proxy138.merge(Unknown Source)[:]
at org.apache.camel.component.jpa.JpaProducer.save(JpaProducer.java:102)[264:org.apache.camel.camel-jpa:2.15.1.redhat-621084]
at org.apache.camel.component.jpa.JpaProducer.doInTransaction(JpaProducer.java:78)[264:org.apache.camel.camel-jpa:2.15.1.redhat-621084]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)[140:org.apache.servicemix.bundles.spring-tx:3.2.12.RELEASE_2]
at org.apache.camel.component.jpa.JpaProducer.process(JpaProducer.java:61)[264:org.apache.camel.camel-jpa:2.15.1.redhat-621084]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.SendProcessor.doInAsyncProducer(SendProcessor.java:167)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:304)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:162)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103)[150:org.apache.camel.camel-jms:2.15.1.redhat-621084]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.ups.ops.cipe.external.exception.entity.ExceptionEntity.packageTrackingNumber
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:62)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:344)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:4550)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:158)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:86)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:833)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:817)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:821)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:889)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
... 33 more
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String field com.ups.ops.cipe.external.exception.entity.ExceptionEntity.packageTrackingNumber to com.ups.ops.cipe.external.exception.entity.ExceptionEntity
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)[:1.8.0_66]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)[:1.8.0_66]
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)[:1.8.0_66]
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)[:1.8.0_66]
at java.lang.reflect.Field.get(Field.java:393)[:1.8.0_66]
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:59)[279:org.hibernate.core:4.2.20.Final-redhat-1]
... 41 more
玩了很久之后,OSGI 和 Hibernate 似乎玩得不是很好。我找到了一些 JIRA 票证来改进这一点。现在我在应用程序卸载和重新安装之间对与休眠相关的包发出刷新命令。
https://hibernate.atlassian.net/browse/HHH-9818
https://hibernate.atlassian.net/browse/HHH-8501
注意:需要 hibernate-OSGI 6 才能正常工作。
对 JPA 相当陌生,我有一个使用它的骆驼路线,所以我无法准确理解我的问题是什么以及如何解决它。经过更多测试后,我开始意识到这个错误似乎只在我的 karaf 容器中重新启动我的包后才会发生。如果我第一次加载容器并安装它,一切似乎 运行 都很好。我添加了我的特征文件信息
Version information:
JBoss 6.2.1
Camel Version: 2.15.1.redhat-621084
Hibernate Version: 4.2.20.Final-redhat-1
from(exceptionInputQueue).routeId("PackageExceptionRoute")
.unmarshal(exceptionDataFormat).id("UnmarshalException")
.convertBodyTo(ExceptionEntity.class).id("ExceptionModelToEntity")
.to("jpa:" + ExceptionEntity.class.getName()).id("PersistExceptionEntity");
@Entity
@Table(name = "Exception")
public class ExceptionEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "PackageTrackingNumber", updatable = false, nullable = false, length = 18)
private String packageTrackingNumber;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "ExceptionTimestamp")
private Date exceptionTimestamp;
@Column(name = "InformationSourceCode", length = 2)
private String informationSourceCode;
@Column(name = "ExceptionReasonCode", length = 2)
private String exceptionReasonCode;
@Column(name = "ExceptionResolutionCode", length = 2)
private String exceptionResolutionCode;
@Column(name = "ExceptionStatusCode", length = 2)
private String exceptionStatusCode;
@Column(name = "ExceptionCountryCode", length = 2)
private String exceptionCountryCode;
@Column(name = "ExceptionLocationNumber", length = 5)
private String exceptionLocationNumber;
//... hashcode, equals, toString, and getters/setters excluded
}
骆驼语境
<camelContext id="PackageExceptionRouteContext" xmlns="http://camel.apache.org/schema/spring"
streamCache="true">
<routeBuilder ref="PackageExceptionRoute" />
</camelContext>
<bean id="PackageExceptionRoute" class="com.ups.ops.cipe.internal.route.PackageExceptionRoute">
<property name="exceptionInputQueue" value="ibmmq:queue:myQueueName" />
<property name="exceptionDataFormat" ref="GsonDataFormat" />
</bean>
<bean id="GsonDataFormat" class="org.apache.camel.component.gson.GsonDataFormat">
<property name="unmarshalType"
value="com.ups.ops.cipe.internal.eud.model.EudExceptionModel" />
<property name="dateFormatPattern" value="yyyy-MM-dd' 'HH:mm:ss.SSS' 'X" />
</bean>
<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="transactionManager" ref="transactionManager" />
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="PackageException" />
<property name="jpaVendorAdapter" ref="jpaAdapter" />
<property name="jpaDialect" ref="jpaDialect" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="generateDdl" value="true" />
<property name="showSql" value="false" />
<property name="database" value="SQL_SERVER" />
<property name="databasePlatform" value="org.hibernate.dialect.SQLServer2012Dialect" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="dataSource" />
<property name="jpaDialect" ref="jpaDialect" />
</bean>
<bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
<bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="myDBURL" />
<property name="username" value="myUser" />
<property name="password" value="myPass" />
</bean>
<bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
<property name="transactionManager" ref="transactionManager" />
</bean>
<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent"
destroy-method="doStop">
<property name="transacted" value="false" />
<property name="concurrentConsumers" value="1" />
<property name="maxConcurrentConsumers" value="1" />
<property name="acceptMessagesWhileStopping" value="true" />
<property name="acknowledgementModeName" value="CLIENT_ACKNOWLEDGE" />
<property name="cacheLevelName" value="CACHE_CONSUMER" />
<property name="connectionFactory">
<bean class="org.springframework.jms.connection.SingleConnectionFactory"
destroy-method="destroy">
<constructor-arg>
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType" value="1" />
<property name="channel" value="myChannel" />
<property name="hostName" value="myHostname" />
<property name="port" value="myPort" />
<property name="queueManager" value="myQueueManager" />
</bean>
</constructor-arg>
</bean>
</property>
</bean>
Persistence.xml
<persistence-unit name="PackageException" transaction-type="RESOURCE_LOCAL">
<class>com.ups.ops.cipe.external.exception.entity.ExceptionEntity</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServer2012Dialect" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
专题文件
<feature name="myFeature-all" version="${project.version}">
<feature>camel-gson</feature>
<feature>camel-quartz</feature>
<feature>camel-jpa</feature>
<feature>camel-jgroups</feature>
<feature>hibernate</feature>
<bundle>mvn:com.fun.my.project/PackageExceptionBundle/${project.version}</bundle>
</feature>
堆栈跟踪
javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.ups.ops.cipe.external.exception.entity.ExceptionEntity.packageTrackingNumber
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:898)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_66]
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:366)[261:org.apache.servicemix.bundles.spring-orm:3.2.12.RELEASE_2]
at com.sun.proxy.$Proxy138.merge(Unknown Source)[:]
at org.apache.camel.component.jpa.JpaProducer.save(JpaProducer.java:102)[264:org.apache.camel.camel-jpa:2.15.1.redhat-621084]
at org.apache.camel.component.jpa.JpaProducer.doInTransaction(JpaProducer.java:78)[264:org.apache.camel.camel-jpa:2.15.1.redhat-621084]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)[140:org.apache.servicemix.bundles.spring-tx:3.2.12.RELEASE_2]
at org.apache.camel.component.jpa.JpaProducer.process(JpaProducer.java:61)[264:org.apache.camel.camel-jpa:2.15.1.redhat-621084]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.SendProcessor.doInAsyncProducer(SendProcessor.java:167)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:304)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:162)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)[146:org.apache.camel.camel-core:2.15.1.redhat-621084]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103)[150:org.apache.camel.camel-jms:2.15.1.redhat-621084]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990)[141:org.apache.servicemix.bundles.spring-jms:3.2.12.RELEASE_2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.ups.ops.cipe.external.exception.entity.ExceptionEntity.packageTrackingNumber
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:62)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:344)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:4550)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:158)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:86)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:833)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:817)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:821)[279:org.hibernate.core:4.2.20.Final-redhat-1]
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:889)[277:org.hibernate.entitymanager:4.2.20.Final-redhat-1]
... 33 more
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String field com.ups.ops.cipe.external.exception.entity.ExceptionEntity.packageTrackingNumber to com.ups.ops.cipe.external.exception.entity.ExceptionEntity
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)[:1.8.0_66]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)[:1.8.0_66]
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)[:1.8.0_66]
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)[:1.8.0_66]
at java.lang.reflect.Field.get(Field.java:393)[:1.8.0_66]
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:59)[279:org.hibernate.core:4.2.20.Final-redhat-1]
... 41 more
玩了很久之后,OSGI 和 Hibernate 似乎玩得不是很好。我找到了一些 JIRA 票证来改进这一点。现在我在应用程序卸载和重新安装之间对与休眠相关的包发出刷新命令。
https://hibernate.atlassian.net/browse/HHH-9818
https://hibernate.atlassian.net/browse/HHH-8501
注意:需要 hibernate-OSGI 6 才能正常工作。