Learn how to create an admin client connection from Liberty profile to a WebSphere Application Server V8.5.5 deployment manager!

This article takes you through the steps to allow your applications running on Liberty profile servers to establish a connection to a WAS V8.5.5 full profile server and use admin client APIs to manage that environment.

Before you start

  1. Install Eclipse, download the WAS Developer Tools, and install the Liberty runtime. Getting started with WAS Liberty profile describes how to do this.
  2. Take copies of the following files from your WebSphere 8.5.5 installation:
    • ${WAS_INSTALL_ROOT}/runtimes/com.ibm.ws.admin.client_8.5.0.jar
    • ${WAS_INSTALL_ROOT}/runtimes/com.ibm.ws.orb _8.5.0.jar
    • ${WAS_INSTALL_ROOT}/etc/tmx4jTransform.jar
    • ${USER_INSTALL_ROOT}/properties/soap.client.props


There are three main steps:

1) Creating an OSGi bundle to export the packages in the JAR to your custom Liberty feature.

2) Creating a Liberty feature to expose the API of the JAR to all your applications running in your server.

3) Creating a Dynamic Web Application on Liberty, using the WAS Developer Tools to demonstrate the thin client connection.

After completing these three steps, you will have an admin client connection from your Liberty profile server to your running deployment manager.

Creating the OSGi Bundle

  1. Click File > New > OSGi Bundle Project.
  2. Name your bundle and select your target runtime. For this example, no application membership is required.
  3. Put the following JAR files in the BundleContent folder:
    • com.ibm.ws.admin.client_8.5.0.jar
    • com.ibm.ws.orb_8.5.0.jar
  4. In the manifest file, append the following text at the end of the file:
    Bundle-ClassPath: com.ibm.ws.admin.client_8.5.0.jar,
    Export-Package: com.ibm.CORBA.iiop,
    Import-Package: javax.management,

Create and install a Liberty feature

To create your Liberty feature:

  1. Click File > New > Other > OSGi > Liberty Feature Project.
  2. Name your Liberty Feature and select your target runtime. Click Next.
  3. Select your OSGi bundle from the list. Click Finish.
  4. In the manifest file, append the following text:
    IBM-API-Package: com.ibm.CORBA.iiop,

To install your Liberty feature:

  1. Right-click your feature project in the Enterprise Explorer view and select Install Feature.
  2. Select your target runtime, then click Finish.
  3. In the server.xml file for the Liberty server, click the Design tab, then click Feature Manager.
  4. Click Add… and select your Liberty feature from the list; it will have a usr: prefix.

Your server.xml should now have your user-defined feature listed under the featureManager element.

Creating a dynamic Web app

  1. Click File > New > Dynamic Web Project.
  2. In the wizard, name your application, select your target runtime, clear the Add project to an EAR check box, then click Finish.
  3. Right-click your web app project then click New > Servlet. Name your servlet and Java package.
  4. Use the following code in the servlet:
    package //TODO: Your package name;
    import java.io.IOException;
    import java.util.Properties;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import com.ibm.websphere.management.AdminClient;
    import com.ibm.websphere.management.AdminClientFactory;
     * Servlet implementation class AdminClientServlet
    public class AdminClientServlet extends HttpServlet {
    	private static final long serialVersionUID = 1L;
    	// Websphere variables
    	private static final String SERVER_DATA_DIR = System.getProperty("user.dir") + "/data";
    	private static final String USER_INSTALL_ROOT = "user.install.root";
    	// Example Dmgr parameters
    	private static final String HOSTNAME = ""; // TODO: Add your hostname that has the Dmgr
    	private static final String PORT = "8879"; // Default SOAP port
    	private static final String SECURITY_ENABLED = "false";
    	private static final String CACHED_DISABLED = "true";
    	private static final String CONNECTOR_TYPE = AdminClient.CONNECTOR_TYPE_SOAP;
         * @see HttpServlet#HttpServlet()
        public AdminClientServlet() {
            // Overrides WAS variable to new location of tmx4jTransform.jar and soap.client.props
            System.setProperty(USER_INSTALL_ROOT, SERVER_DATA_DIR);
    	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    	protected void doGet(HttpServletRequest request, HttpServletResponse response) 
    			throws ServletException, IOException {
    		//Welcome message
    		response.getOutputStream().println("Started AdminClientServlet.");
    		//Calls client and displays Dmgr information
    		response.getOutputStream().println("Establishing SOAP connection to " + HOSTNAME + ":" + PORT + "...");
    		try {
    			response.getOutputStream().println("Admin client connection established.");
    			response.getOutputStream().println("Domain name: " + client.getDomainName());
    			response.getOutputStream().println("Connection type: " + client.getType());
                response.getOutputStream().println("MBean count: " + client.getMBeanCount());
    		} catch (Exception e) {
    			response.getOutputStream().println("Could not connect to target endpoint. The Dmgr is probably not running.");
    		//Goodbye message
    		response.getOutputStream().println("Finished AdminClientServlet.");
         * Creates AdminClient connection to the specified Dmgr by the input parameters.
         * The Dmgr must be running in order to establish the connection.
         * @param response HttpServletResponse
         * @param host String with hostname
         * @param port String with port
         * @param securityEnabled String with boolean word if security is enabled or not
         * @param cacheDisabled String with boolean word if cached is disabled or not
         * @param connectorType String that specifies connector type
         * @return AdminClient object from the AdminClientFactory if the connection is successful.
         * 		   Null if the connection is not established.
    	 * @throws ConnectorException 
        private static AdminClient createAdminClient(String host, String port, String securityEnabled, 
        		String cacheDisabled, String connectorType) throws Exception {
            // Populates required properties parameters for the connection
            Properties props = new Properties();
            props.setProperty(AdminClient.CONNECTOR_HOST, host);
            props.setProperty(AdminClient.CONNECTOR_PORT, port);
            props.setProperty(AdminClient.CONNECTOR_TYPE, connectorType);
            props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, securityEnabled);
            props.setProperty(AdminClient.CACHE_DISABLED, cacheDisabled);
            // Obtain connection from factory
            AdminClient	client = AdminClientFactory.createAdminClient(props);
            return client;
  5. Fix the project setup and resolve the imports.
  6. To establish the outbound SOAP connection from Liberty profile to the deployment manager, you need to provide the thin client with the properties file, soap.client.props. In your Liberty server directory, create the following directory structures:
    • /data/properties/
    • /data/etc/
  7. Put the soap.client.props file in the properties directory, and the tmx4jTransform.jar file (which prevents some warnings from showing when you run the application) in the etc directory.

  8. Deploy the web application project to the Liberty runtime to install the application. Make sure the ports being used on your Liberty server as well as your full profile server are not the same if they are on the same system.
  9. After your start the application, you can check that everything is working by going the following URL:

    You should see the following message, along with information from the deployment manager: Admin client connection established. If the connection wasn’t successful, you should see the message Could not connect to target endpoint. The Dmgr is probably not running..

2 Comments on "Setting up an admin client from Liberty to a WAS V8.5.5 deployment manager"

  1. Name Andreas January 22, 2016

    For the sample it might be enough to export only com.ibm.websphere.management.
    Depending on what services you want to use you need to export more packages, eg.:

    IBM-API-Package: com.ibm.CORBA.iiop,

    • Seems that OSGi bundle gives an “Package does not exist int this plugin” error. Any way to solve this one?

Join The Discussion

Your email address will not be published. Required fields are marked *