Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the best practice for property files outside the project EAR?

 
William Nelson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm relatively new to JBoss AS and I'm doing a migration from WAS to JBoss. One thing we need to do is keep our datasource usernames/passwords in a properties file outside of the deployed EAR. I can currently get it to work with the following code in jboss-service.xml:

<classpath codebase="file:///C:/props/"/>

What I'd like to do is make this path relative instead of absolute. I guess I'm unclear as to the best practice for configuring external property files in JBoss.

If someone else is doing this, can you please post an example of what you did, along with the java code to access it?

I should mention that we have other property files inside the project and I want to use the same code to access all properties. Here is what that code looks like:

URL url = Thread.currentThread().getContextClassLoader().getResource(property);
Properties p = createPropertyObject(url);

Thanks in advance.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try placing the properties file under %JBOSS_HOME%/server/< serverName>/conf folder, which by default is in the classpath.
 
William Nelson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that takes care of the problem without any additional configuration.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dahood shaikh,
Your post was moved to a new topic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic