Accessing the application management function
The com.ibm.websphere.management.application.AppManagementProxy class provides uniform access to application management functionality, regardless of whether the functionality is accessed from the server process, administrative client process, or a stand-alone Java program in the absence of WebSphere Application Server. Use the code excerpts to learn how to obtain an AppManagementProxy instance in a variety of cases.
This task assumes a basic familiarity with WebSphere Application Server programming interfaces and MBean programming. Read about WAS programming interfaces and MBean programming in the application programming interfaces documentation.
Perform any of the following tasks to access application management functionality through programming.
Tasks
- To access application management functionality from WAS code, for example, as a custom service, create the AppManagementProxy class.
AppManagement appMgmt = AppManagementProxy.getJMXProxyForServer();- To access application management functionality from outside WAS through the AppManagement MBean, create an administrative client to establish a connection to WAS and then create the AppManagementProxy class.
AdminClient adminClient = .... // create AppManagement proxy object AppManagement appMgmt = AppManagementProxy.getJMXProxyForClient (adminClient);- To access application management functionality when WAS is not running (local mode), create the AppManagementProxy class.
AppManagement appMgmt = AppManagementProxy.getLocalProxy ();
- When running in local mode set the com.ibm.ws.management.standalone system property to true. To modify configuration documents in a non-default location, set the location of the configuration directory through the was.repository.root system property.
- Although we can use application management functions with or without WAS running, do not access application management functions concurrently through local mode and the AppManagement MBean. Otherwise, updates that are made using these modes can collide and break the integrity of the WAS configuration.
After you successfully create the AppManagementProxy class, we have access to application management functionality.
What to do next
We can perform various management tasks such as installing, uninstalling, editing, and so on.
Related:
Application management Additional Application Programming Interfaces (APIs) Install an application through programming