简体   繁体   English

Mule-在运行时更新第三方库

[英]Mule - Updating third party library in runtime

I'm using Mule Server 3.8 EE which brings commons-lang 2.4 with it. 我正在使用Mule Server 3.8 EE,它带来了commons-lang 2.4。 A third-party library in my project needs commons-lang 2.6, because it uses a method that was introduced in this version. 我项目中的第三方库需要commons-lang 2.6,因为它使用了此版本中引入的方法。

So when I just start my application, I get a java.lang.NoSuchMethodError 所以当我刚启动我的应用程序时,我得到了一个java.lang.NoSuchMethodError

Is there a way to update the dependency in the runtime? 有没有一种方法可以在运行时更新依赖关系? What I tried so far: 到目前为止我尝试过的是:

  • including commons-lang 2.6 in my app -> no effect, the one from the runtime is picked up first 包括我的应用程序中的commons-lang 2.6->无效,首先从运行时中获取一个
  • replacing the jar directly in the runtime -> errors in studio, that the 2.4 jar is missing 直接在运行时替换jar-> Studio中的错误,表明缺少2.4 jar

so maybe i am late BUT -- this is your answer. 所以也许我迟到了-这就是你的答案。 Add the libraries that are newer in the jar distribution to the Build Path. 将jar发行版中较新的库添加到Build Path。 Under Java Build Path screen you should see the libraries listed. 在“ Java构建路径”屏幕下,您应该看到列出的库。 I needed to use Apache http-client 4.5.6 and that's very interesting because it brings with it a lot of other dependencies, so your question was VERY relevant. 我需要使用Apache http-client 4.5.6,这非常有趣,因为它带来了许多其他依赖性,因此您的问题非常相关。 The solution is to rely on JAVA (and not mule -- oops Anypoint or whatever) conventions and make sure the JVM loads my class files first. 解决方案是依靠JAVA(而不是mule-oops Anypoint或其他)约定,并确保JVM首先加载我的类文件。 Then, it won't load the old ones from mule's jar. 然后,它将不会从m子的罐子中装入旧的。 And so I went to the tab Order and Export, and moved Mule to the bottom. 因此,我转到了“订购和出口”选项卡,然后将Mule移至底部。 This simple, trivial change makes it work. 这种简单,微不足道的更改使其可以工作。 I think if we would work with command line and vim, we would all know this. 我认为,如果我们使用命令行和vim,我们都会知道这一点。 But all the IDE gui and everything else makes us forget the simplest things. 但是所有的IDE gui和其他所有内容都使我们忘记了最简单的事情。 Please use it in good health. 请保持身体健康。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM