All Examples  All EJB Examples

Package Index

Enterprise JavaBean home methods example packages

about this example

This example is a package that demonstrates how to use home methods. A Home method is a method declared on the Home class and defined in the bean instance, prefixed by "ejbHome". The example is an entity EJBean called AccountBean.

The example demonstrates:

Client application

The Client application performs these steps:
  1. Looks up the home of the entity bean
  2. Calls a home method on it

how to use this example

To make this example work, make sure that you can compile and run the examples.ejb.basic.containerManaged example.

This example is shipped "pre-built"; you can either run it as shipped, or build the example and run it to test that you are able to successfully build and run EJBeans.

These three sections cover what to do:

  1. Build the example
  2. Set your environment
  3. Run the example

Run the example

  1. Start the WebLogic Server.

    If you're starting the Server from the command line, you'll need to add an entry such as c:/weblogic/eval/cloudscape/lib/cloudscape.jar to the Java system classpath before starting the server, as described in the Administrators Guide Setting up and starting the WebLogic Server.

    You can check that the EJBean has been deployed correctly either by checking the server command line window, or by opening the Console and examining "EJB" under the "Distributed objects"; you should see containerManaged.AccountHome deployed, and can monitor its activity.

  2. Run the client in a separate command line window. Set up your client as described in Setting your development environment, and then run the client by entering:
    $ java examples.ejb20.homeMethods.Client

    If you're not running the WebLogic Server with its default settings, you will have to run the client using:

    $ java examples.ejb20.homeMethods.Client "t3://WebLogicURL:Port"

    where:

    WebLogicURL
    Domain address of the WebLogic Server
    Port
    Port that is listening for connections (weblogic.system.ListenPort)

    Parameters are optional, but if any are supplied, they are interpreted in this order:

    Parameters:
    url - URL such as "t3://localhost:7001" of Server
    user - User name, default null
    password - User password, default null
    accountID - String Account ID to test, default "10020"

  3. You should receive output similar to this:
    
    Beginning ejb20.examples.homeMethods.Client...
    End ejb20.examples.homeMethods.Client...
    
    
    The server should display a confirmation that the home method was called :
    
    
    AccountBean.ejbHomeMethod()
    
    

there's more

Read more about EJB in the BEA WebLogic Server Enterprise Java Beans.

Read more about using the EJB deployer tool in the Deploying EJBs with DeployerTool.

Copyright © 1997-2000 BEA Systems, Inc. All rights reserved.

Last updated 03/28/2000