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. This topic provides code excerpts that demonstrate how to obtain an AppManagementProxy instance in a variety of cases.
Before you begin
This task assumes a basic familiarity with WebSphere Application Server programming interfaces and MBean programming. For information on WAS programming interfaces, see application programming interface (API) documentation. For information on MBean programming, see MBean Java application programming interface (API) documentation.
About this task
Perform any of the following tasks to access application management functionality through programming.
Procedure
- To access application management functionality from WebSphere Application Server 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 WebSphere Application Server 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. If you want to modify configuration documents in a non-default location, set the location of the configuration directory through the was.repository.root system property.
- Although use application management functions with or without WebSphere Application Server 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.
Results
After you successfully create the AppManagementProxy class, you 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 concepts
Application management Related tasks
Installing an application through programming