获取 WebSphere 应用程序服务器的单元名称

Get the cell name of a WebSphere app Server

Is there a way to get the cell name of my WebSphere application server through java?

我尝试使用此代码,但出现空指针异常。

AdminService adminService = AdminServiceFactory.getAdminService(); System.out.println(adminService.getCellName());

使用 JMX 连接 (SOAP/RMI)

从外部 java 应用程序独立连接到 DMGR 或 WAS

https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.0.0/com.ibm.websphere.nd.doc/info/ae/ae/tjmx_develop.html