RMI/IIOP Access to EJBs Sample Application


RMI/IIOP Access to EJBs Sample Application


This document describes how to use the RMI/IIOP Access to EJBs sample application with Sun Java System Web Server.

This document contains the following sections:


Overview

This sample is based on the Currency Converter Enterprise JavaBeans (EJB) sample included in Sun Java System Application Server  8.0/8.1. It demonstrates RMI/IIOP-based access to a simple stateless session bean. This sample describes how to enable concurrent access to the EJBs from web-based servlets/JSPs running on Sun Java System Web Server. 

Compiling and Assembling the Sample Application



To compile and assemble the sample application, complete the following steps.

Note - Make sure that the necessary parameters for running the samples are specified in install_root/samples/java/webapps/common.properties.
  1. Include the following in the install_root/admin-server/config-store/<config>/server.policy file:

    grant {
            permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.loader";
    };


  2. Open the rmi-iiop.build.properties file under the install_root/samples/java/webapps/rmi-iiop/src directory and set the following:

    a. Set the properties iiop.server.host and iiop.listener.port to the correct Sun Java System Application Server 8.0/8.1 machine name and iiop-listener port number respectively, to create the external resource.     
    b. Set the j2ee.jar path to the j2ee.jar.path property. j2ee.jar is located in the appserver_root/lib directory.     
    c. Set the rmi-simpleClient.jar from App server to the rmi-simpleclient.jar.path property.

    Note - Make sure that the RMI/IIOP sample was deployed and running in Sun Java System Application Server 8.0/8.1.
    rmi-simpleClient.jar should be available under the Sun Java System Application Server 8.0/8.1 applications deployment directory.
    The rmi-simpleClient.jar contains more files than needed for running this sample. Therefore, you can use the rmi-simpleClient.jar without any change, or you can open the rmi-simpleClient.jar file, make sure the following necessary classes are present, and remove the remaining items.

    samples/rmi/simple/ejb/Converter.class - Remote Interface
    samples/rmi/simple/ejb/ConverterHome.class - Home Interface
    samples/rmi/simple/ejb/ConverterBean.class - Bean Class
    samples/rmi/simple/ejb/_Converter_Stub.class - Remote Stub
    samples/rmi/simple/ejb/_ConverterHome_Stub.class - Home Stub
    samples/rmi/simple/client/ConverterClient.class - Client Application Main Class

  3. Run ant using the default task:
    # ant       

    This creates the rmi-simple.war file under the install_root/samples/java/webapps/rmi-iiop directory.


Deploying the Sample Application


To deploy the sample application, complete the following steps:

1. Change to the source directory at install_root/samples/java/webapps/rmi-iiop/src.

2. Run the ant tool using the deploy task.

# ant deploy  

Verifying Deployment

(Optional.) You can verify that the application has been registered. Otherwise, proceed directly to Running the Sample Application.

  1. Change to the source directory at install_root/samples/java/webapps/rmi-iiop/src.
  2. Run the ant tool using the list_apps task.
    # ant list_apps
    The rmi-simple module is listed as one of the components.
     

Running the Sample Application


You can run the application through the following URL:

http://Sun_Java_System_Web_Server_hostname:port/rmi-simple/index.jsp

Undeploying the Sample Application

After successfully deploying and running the application, you might decide to undeploy it and remove the files. To undeploy the application, complete the following steps:
  1. Change to the source directory at install_root/samples/java/webapps/rmi-iiop/src.

  2. Run ant using the undeploy task.
    # ant undeploy

  3. Run the ant tool using the delete_resource task.

    # ant delete_resource

     
    This removes the deployed resource.


Copyright © 2007 Sun Microsystems, Inc. All rights reserved.