Install J2EE modules with JSR-88
Overview
You can install J2EE modules on an appserver provided by a WAS product using the J2EE Deployment API Specification (JSR-88) which defines standard APIs to enable deployment of J2EE applications and stand-alone modules to J2EE product platforms. The J2EE Deployment Specification V1.1 is part of the J2EE 1.4 Application Server Developer Release.
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 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.
WAS 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 appserver provided by the WAS platform.
Procedure
- Code a Java program that can access the JSR-88 DeploymentManager class for the product.
- Write code that finds the JAR manifest file key...
J2EE-DeploymentFactory-Implementation-ClassThe WAS application management JAR file containing this key and providing support is...
app_server_root/lib/wjmxapp.jarAfter 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 WAS detailed system requirements 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 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);
- Write code that accesses the DeploymentManager instance for the product WAS 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 the product.
- 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.
Installing J2EE application files
Customizing modules using DConfigBeans
Related information
J2EE Application Deployment Specification
WAS detailed system requirements