0

I'm using Mule Server 3.8 EE which brings commons-lang 2.4 with it. A third-party library in my project needs commons-lang 2.6, because it uses a method that was introduced in this version.

So when I just start my application, I get a 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
  • replacing the jar directly in the runtime -> errors in studio, that the 2.4 jar is missing
Erik P
  • 353
  • 3
  • 15
  • have you tried this approach https://docs.mulesoft.com/mule-user-guide/v/3.7/adding-and-removing-user-libraries – Alpesh Gediya Oct 15 '16 at 10:13
  • This only adds a library, but then the already existing older version is picked up first by the classloader and the error remains (like when adding with maven) – Erik P Oct 17 '16 at 07:43

1 Answers1

0

so maybe i am late BUT -- this is your answer. Add the libraries that are newer in the jar distribution to the Build Path. Under Java Build Path screen you should see the libraries listed. 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. 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. Then, it won't load the old ones from mule's jar. And so I went to the tab Order and Export, and moved Mule to the bottom. This simple, trivial change makes it work. I think if we would work with command line and vim, we would all know this. But all the IDE gui and everything else makes us forget the simplest things. Please use it in good health. :)