• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JBOSS configuring properties fies in classpath

 
Naveen Gopi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic