为什么Java仍然找到旧方法,即使我将及其库库更新为较新版本?

发布于 2025-02-13 12:19:34 字数 901 浏览 1 评论 0原文

我需要在项目中迁移第三方库 - 让我们称其为myProject

myproject ---使用--->企业库a ---使用---> mule-core v3.4

我正在使用maven,我将所有m子依赖项排除在库a中,而是用mule-core v3.9代替。不过,即使生成的胖罐仅包含mule-core v3.9,我仍然看到该应用程序加载了org.mule.util.util.attributeevaluator 课。

看来,该类,用mule-core v3.4用于包含以下方法:

public void initialize(final ExpressionManager expressionManager)

在mule-core 3.9中,该方法将其签名更改为以下:

public AttributeEvaluator initialize(final ExpressionManager expressionManager)

由于此更改,因此企业库一个错误的失败:

Caused by: java.lang.NoSuchMethodError: org.mule.util.AttributeEvaluator.initialize(
   Lorg/mule/api/expression/ExpressionManager;)V

我发现唯一可以使用的解决方案是将企业库A的源代码带入我的项目的源代码,并以正确的依赖性对mule-core再次编译。 v3.9,但我敢肯定有一种更好的方法。

你有什么建议吗?

I need to migrate a third party library in a project - let's call it MyProject.

MyProject ---uses---> Enterprise library A ---uses---> mule-core v3.4

I'm using Maven and I excluded all mule dependencies from library A, replacing it with mule-core v3.9 instead. Still, even if the fat jar that's generated contains only mule-core v3.9, I still see that the application loads an old version of the org.mule.util.AttributeEvaluator class.

It seems that this class, in mule-core v3.4 used to contain the following method:

public void initialize(final ExpressionManager expressionManager)

In mule-core 3.9, the method changed its signature to the following:

public AttributeEvaluator initialize(final ExpressionManager expressionManager)

Because of this change, the enterprise library A fails with the following error:

Caused by: java.lang.NoSuchMethodError: org.mule.util.AttributeEvaluator.initialize(
   Lorg/mule/api/expression/ExpressionManager;)V

The only solution that I found to be working was to bring the source code of Enterprise Library A into the source code of my project and to compile it again with the correct dependency to mule-core v3.9, but I'm sure that there is a better way.

Do you have any suggestions ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文