Kolibri
Kolibri

Reputation: 567

Loading Jar files in a particular order on Tomcat 6

I'm working on a web application where I have dependencies on two different jars containing two different versions of the same class. The jar files are supplied by an external vendor and cannot be changed.

I've created a custom class loader, which first first tries to load classes from a specific set of jars, and if that fails it just loads the class in the standard manner. This makes it possible to ensure that a specific set of jar files are always used first. This solves my problem.

However, I was wondering if there was an easier way.

Upvotes: 2

Views: 328

Answers (1)

Jim Garrison
Jim Garrison

Reputation: 86774

Other than rearchitecting your app for OSGi, I'd say that's the best solution.

Upvotes: 1

Related Questions