0

Trying to figure out how will the JVM decide which dependency to use:

  1. We have a gradle compiled fatJar, containing several dependencies, i.e. Jackson X version etc.
  2. My app is a Play framework 1.x app, using the the fatJar artifact from stage 1, and other dependencies, including aws java sdk which uses Jackson itself, newer than X version.

How can I tell which Jackson version is used in runtime? [It seems that on 1 env it uses the correct one, and on the other, aws sdk is using the incorrect Jackson]

Nati
  • 1,034
  • 5
  • 19
  • 46
  • You could use [this technique](https://stackoverflow.com/questions/1983839/determine-which-jar-file-a-class-is-from) plus some additional logging if you're able to redeploy, just to confirm your theory. – Michael Sep 07 '17 at 08:31

1 Answers1

1

In simple case when you provide classpath to java and do not use any classloader the answer is simple. It will search classpath in order you provide.

I strongly discourage you from relying on that behavior.

There is solutions for you problem. One of them to use OSGi it allows to use multiple version of libraries, but i must mention that it is heavy framework.

talex
  • 17,973
  • 3
  • 29
  • 66