How to get the websphere cellname from the Java code

reddy2388
reddy2388 used Ask the Experts™
on
HI

we  have a typical application    which is irritating  where we have copy the properties files after installing the EAR

inside the ear  have to repeat the process for two environments  


we are planning to avoid this issue  

in the process i need to get the CELLNAME  using the JAVA CODE
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can use the "com.ibm.websphere.management.AdminServiceFactory" class to get information about WAS management in your application running on WAS.
You will find the class in 1 of the jar files under the WAS lib directory; I don't remember the exact jar and it will differe from WAS version to version.
The code would be
AdminService adminService = AdminServiceFactory.getAdminService() ;
System.out.println(adminService.getCellName()); //Returns the name used to identify the current cell in which this process is configured.
http://publib.boulder.ibm.com/infocenter/wasinfo/v5r0/index.jsp?topic=%2Fcom.ibm.wasee.doc%2Finfo%2Fee%2Fjavadoc%2Fee%2Fcom%2Fibm%2Fwebsphere%2Fmanagement%2FAdminServiceFactory.html 

Author

Commented:
Thanks  anil for the info

Author

Commented:
it helped little  bit

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial