使用 @Transactional、Spring 2.5 和 cglib 部署时出现 AbstractMethodError
希望你能帮忙解决这个问题。我使用 Spring @Transactional
注释来标记方法事务,并且我有必要的
。我在我的构建中包含了 Spring 2.5.6 和 cglib 2.1_3。
在部署(到 Websphere 7 运行时)时,我看到 bean 创建异常,其根本原因是:
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
我认为这意味着我们正在 generateClass(...)
实例上调用 generateClass(...)
方法。 code>AbstractClassGenerator,它没有实现该方法。由于所有这些东西似乎都是在 Spring 中透明设置的,所以我不确定从这里到哪里去解决问题......有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜你有多个 cglib 副本。您的应用程序服务器有自己的副本吗?如果是这样,您最好也不要将其包含在您的应用程序中。
另一种可能性是您缺少
asm.jar
,尽管在这种情况下错误可能会显示不同的内容。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.正如 Skaffman 建议的那样,检查是否存在 cglib 的重复副本。我手头没有 WAS 7,但我查看了构建在 WAS 7 之上的 WPS 7,并注意到有一个 JAR - cglib-nodep-2.1_3.jar,它是 SCA 功能包的一部分。
您的计算机上是否有 SCA 功能包,并查看该文件是否存在。
我会打开类加载跟踪来查看该类是从哪个 Jar 中获取的,并对它执行 cavaj 以查看它支持的方法是什么。
当你说具体子类似乎解决了这个问题时,我也感到很困惑!如上所述,我首先会找到在运行时加载这些类的 Jar,然后弄清楚发生了什么。
华泰
曼鲁
As Skaffman suggested check if there is a duplicate copy of cglib. I don't have a WAS 7 handy with me but i looked at my WPS 7 which is built on top of WAS 7 and noticed that there is a JAR - cglib-nodep-2.1_3.jar which is part of the SCA feature pack.
Do you have the SCA feature pack on your machine and see if this file exists there.
I would turn on class loading trace to see which Jar is this class being picked up from and do a cavaj on it to see what are the methods supported by it.
It beats me too when you say that concrete subclass seems to solve this problem!. As mentioned above, i would first locate the Jar that loads these classes during runtime and then figure out what is happening.
HTH
Manglu