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).
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
- 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-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 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 The product 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.