使用 @Transactional、Spring 2.5 和 cglib 部署时出现 AbstractMethodError

发布于 2024-10-15 03:15:59 字数 863 浏览 3 评论 0原文

希望你能帮忙解决这个问题。我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

木森分化 2024-10-22 03:15:59

我猜你有多个 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.

心如狂蝶 2024-10-22 03:15:59

正如 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文