Search code examples
classloaderjboss5.x

Adding second conf folder to JBoss 5.1.0


We have a slightly modified JBoss 5.1.0 configuration, where we have added a new folder called <JBOSS_HOME>/myconf to the classpath. Here is the pertinent bit of conf/jboss-service.xml:

<server>
    <classpath codebase="${jboss.server.lib.url}" archives="*"/>
    <classpath codebase="${jboss.common.lib.url}" archives="*"/>
    <classpath codebase="myconf" archives="*"/>
    ...
</server>

The idea being that application-specific configuration files can go into <JBOSS_HOME>/myconf while JBoss-specific configuration files can remain in <JBOSS_HOME>/conf.

In myconf I have a file called myapp_log4j.xml which is a standard Log4J configuration file. This file is loaded by an AOP interceptor using getResourceAsStream("/myapp_log4j.xml").

If the .xml file is in the following location it works:

<JBOSS_HOME>/myconf/conf/myapp_log4j.xml

though if it is in this location, it doesn't:

<JBOSS_HOME>/myconf/myapp_log4j.xml

Why does the .xml file need to be inside a conf subfolder, and is there any way we can change/fix this?


Solution

  • To summarise the comments, trying to put application-specific config into a separate conf-style JBoss directory is doomed to failure. JBoss isn't meant to bend that way.

    App-specic config should go either (a) inside the application (i.e. inside the EAR/WAR), or (b) somewhere outside of JBoss entirely.