Develop administrative programs for multiple Java 2 Platform, Enterprise Edition application servers
We can develop an administrative client to manage multiple vendor application servers through existing MBean support in the WebSphere Application Server.
Existence of MBeans for stopped components
The WAS completely implements the Java 2 Platform, Enterprise Edition (J2EE) Management specification. However, some differences in details between the J2EE specification and the WAS implementation are important for you to understand when you access WebSphere Application Server components. These differences are important to you when you access application MBeans because use either the WebSphere Application Server programming model or the J2EE programming model.
In the WebSphere Application Server programming model, if an MBean exists, one can assume that it is running. If an MBean does not exist, one can assume that it is stopped. Transient states between the started state and the stopped state are the same as the stopped state, which means that no MBean exists.
In the J2EE programming model, the MBean always exists regardless of the state of the component.
You can determine the state of a component by querying the state attribute. However, the state attribute only exists for MBeans that are state manageable, meaning that they implement the StateManageable interface. State manageable MBeans have start(), startRecursive(), and stop() operations whether these MBeans are J2EE MBeans or WAS MBeans. Additionally, the WebSphere Application Server defines the stateful interface. The stateful interface means that the component has a state and emits the j2ee.state.notifications method, but that the component cannot directly manage the state. For example, a Web module cannot stop itself. However, the application that contains the Web module can stop it.
Not all MBeans that have a state are state-manageable. Servlets, J2EE modules and enterprise beans, for example, are all stateful, but are not state manageable. The J2EE server is not state-manageable because no start() operation is available on a server.
The J2EEApplication MBean is an example of a state manageable MBean. When the WebSphere Application Server starts, each application activates a J2EEApplication MBean for itself. A J2EEApplication MBean has a J2EE type of J2EEApplication (for example, ObjectName *:*,j2eeType=J2EEApplication). If the application starts, it also activates an Application MBean with a type of Application (for example, *:*,type=Application). When the application changes state, the Application MBean is activated or deactivated. However, the J2EEApplication MBean is always activated. We can retrieve the application state changes by getting the state attribute.
The modules attribute on the J2EEApplication component returns an array of object names, one for every module in the application. The Application Server activates an MBean for each of these modules only after the Application Server starts the application. The managed enterprise bean isRegistered(ObjectName) method returns false if the application, and therefore the module, is not running.
All of the attributes that are defined in the J2EE management specification return valid values when the managed object stops. Other attributes and operations, for example those that are specifically defined for the Application Server, use the com.ibm.websphere.management.exception.ObjectNotRunningException exception if they are accessed when the object is stopped.
If you install the application while the server runs, the application installs the J2EEApplication MBean when the installation completes. Conversely, when the application uninstalls the J2EEApplication MBean, the application deactivates the MBean.
Mapping key properties
The following table lists the mapping from the J2EE management-defined j2eeType key property to the WebSphere Application Server type key property. Use either key property to access MBeans. However, only use the j2eeType key property if you want to connect to application servers other than WebSphere Application Server.
j2eeType key property type key property J2EEDomain J2EEDomain [new] J2EEServer Server JVM JVM J2EEApplication Application [separate MBean from j2eeType WebModule WebModule ResourceAdapterModule ResourceAdapterModule EJBModule EJBModule EJB and subtypes / Servlet / ResourceAdapter EJB and subtypes / Servlet / ResourceAdapter JavaMailResource MailProvider JNDIResource NameServer JMSResource JMSProvider JTAResource TransactionService RMI_IIOPResource ORB URLResource URLProvider JDBCResource JDBCProvider JDBCDataSource DataSource JDBCDriver JDBCDriver [new] JCAResource J2CResourceAdapter JCAConnectionFactory J2CConnectionFactory JCAManagedConnectionFactory J2CManagedConnectionFactory [new]
Optional WAS interfaces
The following table shows the optional J2EE management interfaces that WAS provides. Some j2eeType key properties are split on multiples lines for printing purproses.
j2eeType key property EventProvider interface StateManageable interface StatisticsProvider interface J2EEDomain No No No J2EEServer Yes Stateful No JVM No No Yes J2EEApplication Yes Yes No WebModule Yes Stateful No ResourceAdapterModule Yes Stateful No EJBModule Yes Stateful No AppClientModule Yes Stateful No EJB and subtypes / Servlet / ResourceAdapter No No Yes JavaMailResource No No No JNDIResource No No No JMSResource No No No JTAResource Yes No Yes RMI_IIOPResource No No Yes URLResource No No No JDBCResource No No Yes JDBCDataSource No No No JDBCDriver No No No JCAResource Yes No Yes JCAConnectionFactory No No No JCAManagedConnection FactoryNo No No
Related Tasks
Deploying and managing a custom Java administrative client program with multiple Java 2 Platform, Enterprise Edition application servers