• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to read .properties files on classpath in a web application

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am using below code to read the properties files that are on the classpath,

ClassLoader.getSystemResources("my-config-file.properties");

What I want is that at runtime I may have various jars attached and each jar might have this property file. So with above code I want to read all properties files available and make a combined configuration.

Now this code was working well for the simple java project. But it does not work for a web application (deployed on WebSphere). I guess the reason is that in the case of web applications multiple class loaders might be involved.

What do I do so that my code will read all properties files. Is there any project that is already doing this, for example Commons Configuration?

-Regards
Ajay
 
Get off me! Here, read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic