Lab 6: Starting with EJB.  

Assignment 4 due May 9. 

Resources:

Basics

  1. If you do not have WebLogic installed please go back to Lab1.
  2. To start your WebLogic server:

      cd ~/weblogic/weblogic700/samples/server/config/examples
      startExamplesServer.sh

    To use the management console go to: http://<machine>.cs.uchicago.edu:7001/console   where <machine> is the host where you started your Weblogic server.  You'll need to enable applets for full functionality.

A number of bean examples are already deployed.

To cleanly stop the server don't use Ctrl-C but:

Deploy a Stateless EJB 

  1. Take a look at this simple stateless session example.  You can find the source code here:

      /stage/classes/current/51024-1/labs/lab6/HelloWorldExample

  2. Copy this example somewhere to your home directory:
    mkdir ~/<YOUR_DIR>
    cp -r /stage/classes/current/51024-1/labs/lab6/HelloWorldExample ~/<YOUR_DIR>/
  1. Go to your bean directory:

      cd ~/<YOUR_DIR>/HelloWorldExample/

    and use the magic Makefile to compile your bean (the building process briefly explained):

      make 

    this will create a jar file ejb_helloWorld.jar that contains all the compiled code needed for your bean and copy it to ~/weblogic/weblogic700/samples/server/config/examples/applications/

    It will also compile your client and put all .class file in the ~/weblogic/weblogic700//samples/server/stage/examples/clientclasses/examples/helloworld/ directory  ( which  is already in your CLASSPATH).

    For this example you do not need to modify the deployment descriptors: ejb-jar.xml and weblogic-ejb-jar.xml but please take a look.

    1. You now need to deploy the bean.  There are a number of ways to do this.

    Info on deploying applications.  More info on editing deployment descriptors.

    1. Run your client:

        java -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory -Djava.naming.provider.url=t3://localhost:7001 examples.helloworld.HelloClient

      Also take a look at the server's output to see the sequence of methods called.

    2. A stateful  session example is available here: 

    /stage/classes/current/51024-1/labs/lab6/Count

     

    Assignment 4 (due May 9, 11:59 pm). Create and deploy your own Stateless EJB

    Now that you  have successfully deployed your first EJB next step is to create a bean yourself.  Implement and deploy the calculator from Lab 5 and 6  as an EJB.   
    Submission Requirements: