我有时只能看到缓存异常,我也无法重现。 所以我只想知道如何继续。
我们正在使用Jboss As 5.1和Hibernate 3.3.2.GA版本
我们有一个实体
@Table(name = "TBL_COUNTRY")
@Entity
@Cache(region="/country", usage=CacheConcurrencyStrategy.READ_ONLY)
public class Country implements Serializable {
}
Hibernate配置:
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<!-- Clustered cache with TreeCache -->
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<property name="hibernate.cache.use_second_level_cache" value="true" />
name="hibernate.cache.use_query_cache" value="true" />
name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory" />
<property name="hibernate.cache.region.jbc2.query.localonly" value="true"/>
<property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager" />
<property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity" />
<property name="hibernate.cache.region.jbc2.cfg.query" value="local-query" />
<property name="hibernate.cache.region_prefix" value="ecommerce"/>
<property name="jboss.depends.1" value="jboss:service=Naming"/>
<property name="jboss.depends.2" value="jboss:service=TransactionManager"/>
<property name="jboss.depends.3" value="jboss.cache:service=CacheManager"/>
<property name="jboss.depends.4" value="jboss.jca:name=ecomm-ds,service=ManagedConnectionPool"/>
</properties>
附加日志
2017-07-26 18:31:45,849警告 [com.arjuna.ats.arjuna.logging.arjLoggerI18N] (HTTP-XXXXXXXXXX%2F10.137.96.103-8080-17) [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - 失败了 com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@1e9b02ed org.jboss.cache.optimistic.DataVersioningException:Transaction 试图创建/电子商务/货币/ QUERY / sql:选择 currency2_.ID为ID7_,currency2_.CONVERSION_FACTOR为CONVERSION2_7_, currency2_.ISO_NAME为ISO3_7_,currency2_.NAME为NAME7_, currency2_.SYMBOL as SYMBOL7_来自TBL_COUNTRY country0_ left outer 加入TBL_SHIPPING_ZONE_COUNTRY country0_1_ country0_.ID = country0_1_.COUNTRY_ID内部联接TBL_SHIPPING_ZONES shippingzo1_在country0_1_.SHIPPING_ZONE_ID = shippingzo1_.ID内部 加入TBL_CURRENCIES currency2_ shippingzo1_.CURRENCY_ID = currency2_.ID其中country0_.ID =?; 参数:;命名参数:{countryCode = US}重新。它已经 自此交易开始以来,由另一个(可能是 远程)交易。我们有一个并发的创建活动。 在org.jboss.cache.interceptors.OptimisticValidatorInterceptor.visitOptimisticPrepareCommand(OptimisticValidatorInterceptor.java:116) 在org.jboss.cache.commands.tx.OptimisticPrepareCommand.acceptVisitor(OptimisticPrepareCommand.java:55) 在org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116) 在org.jboss.cache.interceptors.OptimisticLockingInterceptor.visitOptimisticPrepareCommand(OptimisticLockingInterceptor.java:89) 在org.jboss.cache.commands.tx.OptimisticPrepareCommand.acceptVisitor(OptimisticPrepareCommand.java:55) 在org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116) 在org.jboss.cache.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:131) 在org.jboss.cache.commands.AbstractVisitor.visitOptimisticPrepareCommand(AbstractVisitor.java:155) 在org.jboss.cache.commands.tx.OptimisticPrepareCommand.acceptVisitor(OptimisticPrepareCommand.java:55) 在org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116) 在org.jboss.cache.interceptors.TxInterceptor.runPreparePhase(TxInterceptor.java:682) at org.jboss.cache.interceptors.TxInterceptor $ LocalSynchronizationHandler.beforeCompletion(TxInterceptor.java:1102) at org.jboss.cache.interceptors.OrderedSynchronizationHandler.beforeCompletion(OrderedSynchronizationHandler.java:81) 在com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101) 在com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269) 在com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89) 在com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177) at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1423) 在com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137) 在com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75) 在org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170) 在org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87) at org.jboss.aspects.tx.TxInterceptor $ Required.invoke(TxInterceptor.java:190) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在org.jboss.ejb3.security.RunAsSecurityInterceptorv2.invoke(RunAsSecurityInterceptorv2.java:94) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:323) at org.jboss.ejb3.stateless.StatelessContainer.invokeEndpoint(StatelessContainer.java:691) 在org.jboss.wsf.container.jboss50.invocation.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:96) 在org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222) at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474) //省略