1

Every time i sent a message with JmsTemplate the exception will be thrown. (I used Spring 3.0.5.RELEASE). I cant find the incompatible classes!

Spring jars in my class path:

Spring jars in my class path

The error log:

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 ...
Arya
  • 2,809
  • 5
  • 34
  • 56

2 Answers2

1

JmsResourceHandler extends org.springframework.transaction.support.ResourceHolderSupport; and ResourceHolderSupport implements ResourceHolder.

ResourceHolderSupport was in two jars:

  • Spring-dao-2.0.8
  • Spring-tx-3.0.5.Release

I solved the problem by using Spring-orm-3.0.5.Release, instead of spring-hibernate3-2.0.8,.

Arya
  • 2,809
  • 5
  • 34
  • 56
0

This kind of issues usually arises when you have incompatible versions of 3rdparties.

In this case try to "align" spring jars - use the same spring version. This should resolve your issues.

Hope this helps.

Mark Bramnik
  • 39,963
  • 4
  • 57
  • 97
  • In other words, you need to override the transitive dependencies so that the same versions of ALL spring jars are used. You can't mix and match, especially when versions are so far (years) apart. – Gary Russell Mar 24 '13 at 14:00