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 开发者_Go百科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?
I disagree. We've been using custom classpath entries for years with no issues. We find it to be a very efficient way to swap out classpath configurations. I think your issue is that JBoss is expecting a URL. E.g.,
<classpath codebase="file:/home/me/myProject/myBranch/patches" archives="*"/>
<classpath codebase="file:/home/me/myProject/myBranch/lib" archives="*"/>
<classpath codebase="file:/home/me/myProject/myBranch/ext/" archives="*"/>
<classpath codebase="file:/home/me/myProject/myBranch/"/>
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.
精彩评论