JBoss/EJB - location of custom configuration file

configuration-files, ejb-3.0, java, jboss

Solution

The JBoss documentation specifies that the environment variable jboss.server.data.dir is the "location available for use by services that want to store content in the file system". See here for more details. You can get the value of the variable by

System.getProperty("jboss.server.data.dir");

And, as shown in the link, the location of the server/[config]/data directory will be returned. Store the template file there when you deploy your app, and instruct your admins to modify it there.

Problem

I'm implementing an EJB-based system in JBoss. One of my message driven beans will be responsible for sending emails. I want the email template to be stored externally (probably as XML) so that it can easily be changed without having to change the code/redeploy the bean, etc. Where should this file be placed and how do I reference it?

Original source

Related problems