0

I was unable to find a decent clear post on this so here is my question.
I have a J2EE based app to deploy on Websphere7 (WAS). The EAR contains WAR, also the WAR is dependent on another JAR.
1) Now I plan to write a properties file in the JAR, but not sure how to locate that after deployment on WAS. 2) Also I plan to access it using ResourceBundle as this is how I access another properties file in the WAR.

ResourceBundle rb = ResourceBundle.getBundle("application");

Any ideas on this or is there another way I could configure some properties like 'Environment variables/JNDI variables' etc and still access them in the JAR?

Thanks.

james2611nov
  • 473
  • 2
  • 10
  • 27
  • You can [find where a Java class is loaded from](http://stackoverflow.com/a/19494116/823393) and use that. – OldCurmudgeon Nov 25 '14 at 17:29
  • You can check this post - [best place to put properties file in IBM websphere 8.5?](http://stackoverflow.com/a/24021049/3701228). It discusses some of the options. – Gas Nov 25 '14 at 17:55

1 Answers1

0

I posted a solution long time back on this one, please see below link and explanation:

http://gauravwrites.blogspot.com/2009/06/loading-resource-file-runtime-residing.html

Basically you need to use class loader to locate property packaged as part of JAR file, due to the way loading works in WebSphere.

Let me know if you need any information around it.

Gaurav Daga
  • 343
  • 2
  • 11