wood burning stoves
The moose likes JBoss/WildFly and the fly likes PropertiesFile in Classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "PropertiesFile in Classpath" Watch "PropertiesFile in Classpath" New topic

PropertiesFile in Classpath

David Kincade

Joined: Nov 10, 2005
Posts: 7
I am moving an application from WebSphere to JBoss. Not being familiar with the SA tasks of JBoss, I have hit a question (and can't seem to find the answer on the net)...

I have a properties file that is located in the classpath of the application. This properties file must exist outside of the EAR since it contains different values on different servers (dev, test, prod).

How do I configure the deployment of the EAR to add a directory (which would contain the properties file) to add it to the application's classpath?

In WebSphere 5, it used the concept of a Shared Library (which would contain the directory name) and this was added to the application (and therefore part of the application's classpath).

Thanks in advance!
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

How about this:

Maintaining Properties files in JBoss

[My Blog] [JavaRanch Journal]
David Kincade

Joined: Nov 10, 2005
Posts: 7
I'm not sure that the topic of that link is what I am looking for. It appears that the link is talking about how to set system properties for JBoss (or properties that will be available to all applications running on that JBoss server).

I am looking for a way that my application (and preferably ONLY my application) running on a JBoss server will have access to a properties file. In addition, I don't want to have to specify the location of the properties file in my source code ... it should be found as part of the classpath (but not contained in the EAR / WAR / JAR).

Any ideas?
David Kincade

Joined: Nov 10, 2005
Posts: 7
Here is maybe a better way to ask my question ...

I have 2 EARs running on one JBoss server. Inside each EAR is a WAR ... and that WAR uses log4j. However, the log setting (log4j.xml) is different for each EAR.

How can I create 2 log4j.xml files and put them in 2 different places and tell each EAR where the proper log4j.xml file is located?

Thanks in advace
I agree. Here's the link: http://aspose.com/file-tools
subject: PropertiesFile in Classpath
It's not a secret anymore!