Search code examples
springwebspheretransactionalcglib

AbstractMethodError on deploy with @Transactional, Spring 2.5 and cglib


Hope you can help with this. I'm using the Spring @Transactional annotation to mark a method transactional, and I have the requisite <tx:annotation-driven transaction-manager="txManager"/>. I'm including Spring 2.5.6 and cglib 2.1_3 in my build.

On deployment (to a Websphere 7 runtime), I see bean creation exceptions, with the root cause:

Caused by: java.lang.AbstractMethodError: net/sf/cglib/core/ClassGenerator.generateClass(Lnet/sf/cglib/asm/ClassVisitor;)V
    at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
...and so on

I figure that this means that we are calling the generateClass(...) method on an instance of AbstractClassGenerator, which does not implement that method. As all that stuff seems to be transparently set up in Spring, I'm not sure where to go from here to fix the problem though... any ideas?


Solution

  • I'm guessing you have multiple copies of cglib kicking around. Does your app server have it's own copy? if so, you're better not including it in your application as well.

    Another possibility is that you're missing asm.jar, although the error would likely say something different in that case.