TransactionSynchronization.afterCompletion中的IncompatibleClassChangeError

时间:2013-03-24 11:33:00

标签: java spring spring-jms incompatibility jmstemplate

每当我用JmsTemplate发送消息时,都会抛出异常。 (我用过Spring 3.0.5.RELEASE)。我找不到不兼容的课程!

我班级路径中的春天罐子:

Spring jars in my class path

错误日志:

springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(136) | TransactionSynchronization.afterCompletion threw exception
java.lang.IncompatibleClassChangeError: Class org.springframework.jms.connection.JmsResourceHolder does not implement the requested interface org.springframework.transaction.support.ResourceHolder
    at org.springframework.transaction.support.ResourceHolderSynchronization.afterCompletion(ResourceHolderSynchronization.java:105)
    at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:133)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:904)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:879)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:707)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
    at ...

2 个答案:

答案 0 :(得分:0)

当您拥有不兼容的第三方版本时,通常会出现此类问题。

在这种情况下,尝试“对齐”弹簧罐 - 使用相同的弹簧版本。 这应该可以解决您的问题。

希望这有帮助。

答案 1 :(得分:0)

JmsResourceHandler extends org.springframework.transaction.support.ResourceHolderSupport;和ResourceHolderSupport 实现 ResourceHolder。

ResourceHolderSupport在两个罐子里:

  • 弹簧-DAO-2.0.8
  • 弹簧-TX-3.0.5.Release

我使用Spring-orm-3.0.5解决了这个问题。而不是spring-hibernate3-2.0.8,。