Install J2EE modules with JSR-88

We can install J2EE modules on an application server provided by a WAS product using the J2EE Deployment API Specification (JSR-88).

 

Before you begin

JSR-88 defines standard APIs to enable deployment of J2EE applications and stand-alone modules to J2EE product platforms. The J2EE Deployment Specification V1.1 is available at http://java.sun.com/j2ee/tools/deployment/reference/docs/index.html as part of the 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/.

 

Overview

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 J2EE product platform. The tool provider typically supplies software tools and an integrated development environment (IDE) for developing and assembly of J2EE application modules. The J2EE platform provides application management functions that deploy, undeploy, start, stop, and otherwise manage J2EE applications.

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

 

Procedure

  1. Code a Java program that can access the JSR-88 DeploymentManager class for WebSphere Application Server.

    1. Write code that finds the JAR manifest file key J2EE-DeploymentFactory-Implementation-Class. Under JSR-88, your code finds the DeploymentFactory using the JAR manifest file key J2EE-DeploymentFactory-Implementation-Class. For WebSphere Application Server, the application management JAR file containing this key and providing support is install_root/lib/wjmxapp.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. For example

      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;
      
      // Get the DeploymentFactory implementation class from the MANIFEST.MF file.
      JarFile wjmxappJar = new JarFile(new File(wasHome + "/lib/wjmxapp.jar"));
      java.util.jar.Manifest manifestFile = wjmxappJar.getManifest();
      Attributes attributes = manifestFile.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 WAS DeploymentFactory.
      Class deploymentFactory = Class.forName(className);
      DeploymentFactory deploymentFactoryInstance =
         (DeploymentFactory) deploymentFactory.newInstance();
      
      // Register the DeploymentFactory instance with the DeploymentFactoryManager.
      dfm.registerDeploymentFactory(deploymentFactoryInstance);
      
      // Provide WAS URL, 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 WebSphere Application Server. The WebSphere Application Server URL for deployment has the 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.

The URL for deployment can have an optional parameter connectorType. For example, to use the RMI connector to access myserver, code the URL as follows:

"deployer:WebSphere:myserver:2809?connectorType=RMI"

  • Optional: Code a Java program that can customize or deploy J2EE applications or modules using the JSR-88 support provided by WebSphere Application Server.

  • Start the deployed J2EE applications or standalone J2EE 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.


     

    Related Tasks


    Installing application files
    Customizing modules using DConfigBeans

     

    Related Information


    J2EE Application Deployment Specification