I am working on an existing application that has quite a few external JAR dependencies. I need to improve it to integrate with a third-party application that has an API. Unfortunately, the API is not good enough, and also has a large number of its own dependencies, some of which interfere with mine.
I believe that I should solve this with Classloaders, but I'm trying my best to structure them correctly.
To keep it simple, suppose I have myapp.jar with the hibernate3.jar dependency and vendor-api.jar with the hibernate2.jar dependency (and suppose they are incompatible).
My new piece of code will be in myapp.jar library (although it may be in a separate jar if that helps). Due to how the vendor API works, my new code should extend the class from vendor-api.jar library.
How can I structure Classloaders in such a way that anything inside vendor-api.jar refers only to its own dependencies, and everything on my side refers only to myapp.jar and dependencies?
Thanks Jon
source
share