Installing J2EE modules with JSR-88

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

Before you begin

JSR-88 defines standard application programming interfaces (APIs) to enable deployment of J2EE applications and stand-alone modules to J2EE product platforms. The J2EE Deployment Specification Version 1.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/.

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 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 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 file key J2EE-DeploymentFactory-Implementation-Class.

      Under JSR-88, your code finds the DeploymentFactory using the JAR manifest file key J2EE-DeploymentFactory-Implementation-Class. The product application management JAR file containing this key and providing support is app_server_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.

      Example code 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 http://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;
      
      // 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 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 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 URI for deployment can have an optional parameter connectorType. 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 J2EE applications or modules using the JSR-88 support provided by the product.
  3. 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.



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Aug 29, 2010 7:21:45 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=vela&product=was-nd-dist&topic=trun_app_jsr88
File name: trun_app_jsr88.html