Search code examples
javapluginswildflydevelopment-environmentserviceloader

Modular jars/plugins within a Wildfly Web Application using ServiceLoaders


We extensively use Java ServiceLoaders as a plugin infrastructure for our application components. We define interfaces, and then use the loader to load them at run time. Adding additional jars with extensions and service files are fine for our use cases.

However, i'm struggling to understand how we would be able to continue this approach while deploying an application within Wildfly. The intent is as stated above, the ability to add "extension" jars to the web-application class path without having to

  1. Stop the server
  2. Unzip the war
  3. Add additional jar
  4. Zip war
  5. Start the server

In Tomcat, we could deploy web application folders instead of a war. So stopping the server, dropping in a jar, and starting the server worked fine. Within Wildfly (latest), it appears to not like the deployment of a folder vs war.

I've read about the modules approach, but have not been successful using this approach to get the deployed application to see the module from the service loader implementations.

Would like to know if there is an alternative solution or perhaps we are doing something wrong?

Thanks


Solution

  • WildFly supports exploded deployments with the deployment scanner or using the explode command with jboss-cli. Using the jboss-cli you can even update files remotely.