Search code examples
javashared-librarieswebsphere

Is it possible to reload shared libraries in WebSphere Application Server (WAS) without restarting the application?


I have a WebSphere application that makes use of shared libraries. Whenever an update is made to any jar in the shared libraries path, the application making use of it need to be restarted to get the latest changes. Is it possible to make a WAS application reload the shared libraries without having to be restarted?

I'm using traditional WAS 8.5.5.16.


Solution

  • Short answer: No.

    Long answer: There's a technical reason why you can't do that. Java class loaders don't generally support recreating Class objects that they've already defined - once you define a class, it's defined, and that's that for the life of the class loader (the first step in loadClass is "findLoadedClass", which searches for an existing version of the class you're loading). In order for Java to agree to load a new instance of a Class object, you need to create an entirely new class loader, and in a Java EE (or, at least, WAS) setting, that requires restarting the application.

    I believe from your question that you're simply associating a normal shared library with your application, so this doesn't necessarily apply, but I'd note that if you use an isolated shared library (which has its own class loader) or a shared library loader configured on the server, even restarting the application is not enough, because those library loaders are created with the server, not with the applications, so they require a server restart to pick up changes.