December 21, 2014

How to Manage Properties Files in JBoss Module

From JBoss AS 7 and EAP 6 forth, classloading have changed and all jar dependencies are packaged and loaded as jboss modules.

Besides dependency jar in a module you also might need to be able to configure it for different server environment. The best way and maybe the natural way, is to make use of a java properties file.

This is a good practice, now you can RPM package your custom module. This is how Red Hat do with JBoss EAP 6. With RPM packing you have now the capability of versioning your module and to centrally install it from, e.g. Red Hat Satellite. And finally centrally configure the property file from, e.g. Satellite 6 via Puppet.

But there is classloading gotchas. You need to add <resource-root path="."/> to you module.xml.

See https://developer.jboss.org/wiki/HowToPutAnExternalFileInTheClasspath for longer description.

No comments: