File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes JBOSS configuring properties fies in classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBOSS configuring properties fies in classpath" Watch "JBOSS configuring properties fies in classpath" New topic
Author

JBOSS configuring properties fies in classpath

Naveen Gopi
Greenhorn

Joined: Sep 24, 2007
Posts: 3
In our application we have appstrings.properties and log4j.properties that reside in both the properties directory and in the WAR files WEB-INF/classes directory. On JBOSS, the files that reside in the war files WEB-INF/classes directory take precedence over those defined on the system classpath, namely, in the properties directory. Hence in JBOSS we cannot make any changes in *.properties files located in properties folder.



I was able to find only one solution to this problem ie; by removing the properties files from WEB-INF/classes in the WAR file, so that files inside properties directory will be taken. Is there any other alternative by which JBOSS locates the properties files in properties folder? Is there any configuration that can be done for the same?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

In our application we have appstrings.properties and log4j.properties that reside in both the properties directory and in the WAR files WEB-INF/classes directory


Any specific reason why you have it in 2 places? Which location do you want to be used in your application? The global one or the one in the war?


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Ah, did not completely read your original message.

Naveen Gopi wrote:
I was able to find only one solution to this problem ie; by removing the properties files from WEB-INF/classes in the WAR file, so that files inside properties directory will be taken. Is there any other alternative by which JBOSS locates the properties files in properties folder? Is there any configuration that can be done for the same?


JBoss picks up the one which is first found in the classpath (assuming you are loading the properties file using ClassLoader.getResourceAsStream(...)).

There is an alternate way (not clean and not portable) through which you can use the JBoss server properties to specify the absolute location of the properties file. But before we get into that, if you really need the properties file from the JBoss conf folder why not just remove these files from your application packaging?

Naveen Gopi
Greenhorn

Joined: Sep 24, 2007
Posts: 3
Can you please let me know how that can be done by configuring server properties?? Yes we have decided to remove properties files from war, but before that i wanted to know an alternative way..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBOSS configuring properties fies in classpath
 
Similar Threads
Properties file in WAS?? URGENT!!
Properties file outside the war file
Need Suggetions
Attribute Listener
Where is _wl_cls_gen.jar coming from?