0

I've worked some as an AEM developer which is based on OSGI, and this is where my rudimentary (and a bit outdated) idea stems from. On a new job and completely non-AEM related project, here is what I need to do.

  • Build a service library based on a 3rd party library compliant on JDK8
  • Deploy them as a spring web-app on tomcat, running on JDK9 or higher.

The 3rd party library is a licensed software and cannot be upgraded because of certain legal impasse. A straight-forward deployment on JDK9 fails because of Java API issues.

The theory is to include the entire JDK8 runtime as bundled dependency and deploy it as a OSGI bundle on a JDK9+ compliant OSGI runtime framework.

Here is a little diagram I created to capture the main idea: enter image description here

Could this potentially work? In theory this holds because each OSGI bundle uses its own classloader, so the 3rd-party library should not break because of Java API issues. Also, the plan is to use maven to create a fat (uber) jar.

Another question plaguing me: Is creating an uber-jar including the JDK even a thing? I've created uber-jars before, but not sure how I'd include the JDK as well. Some part of that doesn't seem right. Any suggestion?

Thanks everyone!

Community
  • 1
  • 1
apil.tamang
  • 2,545
  • 7
  • 29
  • 40

1 Answers1

1

You cannot package the JDK class libraries from one JDK implementation and use them on another JDK implementation. Even if you put them in a bundle. JDK class libraries are intimately connected to the underlying JVM implementation and there are many expected singletons which having multiple JDK class libraries present would violate.

BJ Hargrave
  • 9,324
  • 1
  • 19
  • 27