Install enterprise modules with JSR-88
We can install Java EE modules on an appserver provided by a WAS product using the Java EE Application Deployment API spec (JSR-88).
JSR-88 defines standard APIs to enable deployment of Java EE applications and stand-alone modules to Java EE product platforms. The Java EE Application Deployment spec Version 1.1 is available at http://java.sun.com/j2ee/tools/deployment/reference/docs/IBM_HTTP_Server_v735.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/.
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.
WAS 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 WAS platform.
- Code a Java program that can access the JSR-88 DeploymentManager class for WAS ND.
- Write code that finds the JAR manifest attribute J2EE-DeploymentFactory-Implementation-Class.
Under JSR-88, the 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
Environment JAR file containing the manifest attribute Application server APP_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_7.0.0.jar
After the 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 appserver environment follows. The example code requires that you use the development kit shipped with WAS or use the pluggable client for deployment of stand-alone modules. See WAS 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; 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 WAS DeploymentFactory. Class deploymentFactory = Class.forName(className); DeploymentFactory deploymentFactoryInstance = (DeploymentFactory) deploymentFactory.newInstance(); // Register the DeploymentFactory instance with the DeploymentFactoryManager. dfm.registerDeploymentFactory(deploymentFactoryInstance); // Provide WAS URI, user ID, and password. //See the step that follows. wsDM = dfm.getDeploymentManager( "deployer:WebSphere:myserver:8880", null, null);
- Write code that accesses the DeploymentManager instance for WAS ND. WAS ND v7.0 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"- Code a Java program that can customize or deploy Java EE applications or modules using the JSR-88 support provided by WAS ND.
- Start the deployed Java EE applications or stand-alone Java EE modules using the JSR-88 API used to start applications or modules.
Next steps
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
Install enterprise application files
Customizing modules using DConfigBeans
Related
 
Related information
Java EE Application Deployment Specification
WAS detailed system requirements