• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that takes care of the problem without any additional configuration.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dahood shaikh,
Your post was moved to a new topic.
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic