Installing enterprise modules with JSR-88

You can install Java™ Platform, Enterprise Edition (Java EE) modules on an application server provided by a WebSphere® Application Server product using the Java EE Application Deployment API specification (JSR-88).

Before you begin

Deprecated feature: Application installation using the Java EE Application Deployment API specification (JSR-88) was deprecated in WebSphere Application Server Version 8.0. Use another option to deploy applications to a server. The closest option to using the Java EE Deployment API is using Java Management Extensions (JMX) MBean programming. For information on deployment options, see Ways to install enterprise applications or modules.

JSR-88 defines standard application programming interfaces (APIs) to enable deployment of Java EE applications and stand-alone modules to Java EE product platforms. The Java EE Application Deployment specification Version 1.1 is available at http://java.sun.com/j2ee/tools/deployment/reference/docs/index.html as part of the Java 2 Platform, Enterprise Edition (J2EE) 1.4 Application Server Developer Release.

Read about JSR-88 and APIs used to manage applications at http://java.sun.com/j2ee/tools/deployment/.

About this task

JSR-88 defines a contract between a tool provider and a platform that enables tools from multiple vendors to configure, deploy and manage applications on any Java EE product platform. The tool provider typically supplies software tools and an integrated development environment (IDE) for developing and assembly of Java EE application modules. The Java EE platform provides application management functions that deploy, undeploy, start, stop, and otherwise manage Java EE applications.

WebSphere Application Server is a Java EE specification-compliant platform that implements the JSR-88 APIs. Complete the following steps to deploy (install) Java EE modules on an application server provided by the WebSphere Application Server platform.

Procedure

  1. Code a Java program that can access the JSR-88 DeploymentManager class for the product.
    1. Write code that finds the JAR manifest attribute J2EE-DeploymentFactory-Implementation-Class.

      Under JSR-88, your code finds the DeploymentFactory using the JAR manifest attribute J2EE-DeploymentFactory-Implementation-Class. The following product application management JAR files contain this attribute and provide support.

      Table 1. JAR files that contain the manifest attribute . Enable your code to find the DeploymentFactory using the JAR manifest attribute.
      Environment JAR file containing the manifest attribute
      Application server app_server_root/plugins/com.ibm.ws.admin.services.jar
      Application client app_client_root/plugins/com.ibm.ws.j2ee.client.jar
      Thin application client app_client_root/runtimes/com.ibm.ws.admin.client_8.0.0.jar

      After your code finds the DeploymentFactory, the deployment tool can create an instance of the WebSphere DeploymentFactory and register the instance with its DeploymentFactoryManager.

      Example code for the application server environment follows. The example code requires that you use the development kit shipped with the product or use the pluggable client for deployment of stand-alone modules. See WebSphere Application Server detailed system requirements at https://www.ibm.com/support/docview.wss?rs=180&uid=swg27006921 for information on supported development kits.

      import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
      import javax.enterprise.deploy.spi.DeploymentManager;
      import javax.enterprise.deploy.spi.factories.DeploymentFactory;
      import java.util.jar.JarFile;
      import java.util.jar.Manifest;
      
      // Get the DeploymentFactory implementation class from the MANIFEST.MF file.
      File jsr88Jar = new File(wasHome + "/plugins/com.ibm.ws.admin.services.jar");
      JarFile jarFile = new JarFile(jsr88Jar);
      Manifest manifest = jarFile.getManifest();
      Attributes attributes = manifest.getMainAttributes();
      String key = "J2EE-DeploymentFactory-Implementation-Class";
      String className = attributes.getValue(key);
      // Get an instance of the DeploymentFactoryManager
      DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
      
      // Create an instance of the WebSphere Application Server DeploymentFactory.
      Class deploymentFactory = Class.forName(className);
      DeploymentFactory deploymentFactoryInstance =
         (DeploymentFactory) deploymentFactory.newInstance();
      
      // Register the DeploymentFactory instance with the DeploymentFactoryManager.
      dfm.registerDeploymentFactory(deploymentFactoryInstance);
      
      // Provide WebSphere Application Server URI, user ID, and password.
      // For more information, see the step that follows.
      wsDM = dfm.getDeploymentManager(
         "deployer:WebSphere:myserver:8880", null, null);
      
    2. Write code that accesses the DeploymentManager instance for the product.

      The product URI for deployment has the following format:

      "deployer:WebSphere:host:port"

      The example in the previous step, "deployer:WebSphere:myserver:8880", tries to connect to host myserver at port 8880 using the SOAP connector, which is the default.

      You can specify an Internet Protocol Version 6 (IPv6) address for the host element in the URI for deployment. Enclose the IPv6 address in brackets ([]); for example:

      "deployer:WebSphere:[IPv6_address]:port"

      Also, you can add an optional parameter, connectorType, to the URI for deployment. For example, to use the RMI connector to access myserver, code the URI as follows:

      "deployer:WebSphere:myserver:2809?connectorType=RMI"
  2. Optional: Code a Java program that can customize or deploy Java EE applications or modules using the JSR-88 support provided by the product.
  3. Start the deployed Java EE applications or stand-alone Java EE modules using the JSR-88 API used to start applications or modules.

What to do next

Test the deployed applications or modules. For example, point a web browser at the URL for a deployed application and examine the performance of the application. If necessary, update the application.