简体   繁体   中英

Properties file in JAR on Websphere

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM