Beehive Integration in BEA WebLogic Server

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Beehive Applications

WARNING: This document is deprecated as of version 10.0 of WebLogic Server. This deprecation warning applies only to this documentation, and not to the underlying functionality it describes nor to the open-source Beehive project. Users who wish to develop and deploy Beehive applications should do so using Workshop for WebLogic, which offers support for all aspects of Beehive technology. Current documentation for integrating Beehive and WebLogic Server can be found at Workshop for WebLogic Platform User's Guide.

The following sectons provide an introduction to Beehive applications:

 


What Is a Beehive Application?

Beehive is an open source J2EE programming framework designed to make the most difficult J2EE programming tasks easier.

Where the traditional J2EE programmer would use complex APIs and configuration files, the Beehive programmer uses “metadata annotations,” also known simply as “annotations.” Annotations dramatically simplify the J2EE code and allow non-experts to create J2EE applications. Annotations stand in for common, boilerplate coding tasks. Instead of learning the complex J2EE API, developers can set properties on their code using metadata annotations.

Annotations are a new feature in Java, added in the J2SE 5.0 version of the language. For background information about annotations, please see http://java.sun.com/j2se/1.5.0/index.jsp and http://jcp.org/en/jsr/detail?id=175.

Beehive ships with three main components:

The diagram below shows a typical Beehive application. The application has three basic components:

 


Apache Beehive Documentation

Beehive is a project of the Apache Software Foundation. The version of Beehive that is installed on your computer during the installation of WebLogic Server does not necessarily correspond to the version currently documented on the Apache website. To see the full, current Apache Beehive documentation, refer to http://beehive.apache.org.

A copy of the Beehive documentation from the Apache site is installed on your computer when WebLogic Server is installed. This documentation corresponds to the version of Beehive on your computer. To read this documentation, navigate to

<WEBLOGIC_HOME>\beehive\apache-beehive-svn-snapshot\docs\docs 

and double-click on the file index.html in that folder.

Note: The version of Beehive shipped with WebLogic Server 9.2 does not include the web service metadata sub-project. Consequently, the web service metadata documentation has not been included and hyperlinks to the removed documentation content are broken.

 


Running the WebLogic Server/Beehive Integration Samples

Samples Architecture

WebLogic Server contains three interconnected Beehive samples. These samples demonstrate how to build progressively more complex applications based on a simple web service. The simple web service, called creditRatingApp, at the core of these samples takes a nine-digit Social Security number and responds with a credit rating. The remaining two samples are more complex client applications of this basic web service.

These three samples, named creditRatingApp, bankLoanApp, and customerLoanApp, are described in creditRatingApp, bankLoanApp, and customerLoanApp, respectively.

Locating the Samples

The samples documented here are located on your system in

<WEBLOGIC_HOME>\beehive\weblogic-beehive\samples.

creditRatingApp

This sample is a stateless web service (built using JSR 181 web service annotations) that takes a nine-digit Social Security number and responds with a credit worthiness rating. The following two samples are clients of this web service.

bankLoanApp

This sample is an application that evaluates a loan seeking customer. Given the customer’s Social Security number, the application will (1) return an interest rate appropriate for that customer’s credit rating and (2) decide whether or not a customer should be given a loan of a specified amount.

The application consists of a conversational (stateful) web service consisting of a start and a finish method. The start method takes a Social Security number and returns an interest rate based on the customer’s credit rating. The start method acquires the customer’s credit rating by calling the creditRatingApp web service described in creditRatingApp. The credit rating is then passed to a local EJB, which calculates the appropriate interest rate.

The finish method determines whether the customer may borrow a specified amount. This method takes a float value and returns a boolean value. This method also checks a database to see if the customer has borrowed money in the past.

Because this application relies on a database connection, to run this application, you must first create the necessary database. Details on creating the necessary database are described in step 3 in Running the bankLoanApp Application.

The Java source for this web service is located at

bankLoanApp\src\services\pkg\bankLoanConversation.java.

customerLoanApp

This sample is a web application interface on the bankLoanApp sample described in bankLoanApp. It provides JSPs from which users can make requests of and view responses from the bankLoanApp.

Running the Beehive Samples

To run the samples, you must first create a Beehive-enabled server domain, then you must build and deploy the three samples in the following order: creditRatingApp, bankLoanApp, customerLoanApp.

Creating a Beehive-enabled Domain

To create a Beehive-enabled server domain, follow these steps:

  1. Start the domain configuration wizard: Start > BEA Products > Tools > Configuration Wizard.
  2. Click Next on each page of the wizard without changing any of the default values, except for the following changes:

    On the second page (labeled Select Domain Source), place a check in the checkbox next to “Apache Beehive.”

    On the third page (labeled Configure Administrator Username and Password), in the User password field, enter weblogic.

  3. Start an instance of the new server by running
  4. <BEA_HOME>\user_projects\domains\base_domain\startWebLogic.cmd

    on Windows or

    <BEA_HOME>/user_projects/domains/base_domain/startWebLogic.sh

    on UNIX.

  5. Set up the build environment by opening a command shell and running
  6. <BEA_HOME>\user_projects\domains\base_domain\bin\setDomainEnv.cmd

    on Windows or

    <BEA_HOME>/user_projects/domains/base_domain/bin/setDomainEnv.sh

    on UNIX.

Running the creditRatingApp Web Service

To build and deploy the creditRatingApp:

  1. Navigate to creditRatingApp\src.
  2. Run the following Ant command:
  3. ant clean build pkg.exploded deploy.exploded

Running the bankLoanApp Application

  1. Navigate to bankLoanApp\src.
  2. Run the following Ant command:
  3. ant clean build pkg.exploded deploy.exploded
  4. To create the necessary backend database, visit the URL http://localhost:7001/bankLoanWeb and click the link Create the Table. After the table has been created, click Return to index.
  5. To test the bankLoanApp, enter a nine-digit number in the field marked Get the amount borrowed by SSN and click Submit. The amount previously borrowed by the applicant will be displayed in the server console.

Running the customerLoanApp

To build and deploy the customerLoanApp:

  1. Navigate to customerLoanApp\src.
  2. Run the following Ant command:
  3. ant clean build pkg.exploded deploy.exploded
  4. To test the web application, visit the URL http://localhost:7001/customerLoanWeb.
  5. Enter a nine-digit Social Security number to retrieve an interest rate; then request a loan of a specific amount.

 


Upgrade Paths

Upgrading from 9.0

If you have Beehive applications that ran under WebLogic Server 9.0, you will have to make certain changes to them so that they will run under WebLogic Server 9.2. This section discusses those changes.

Beehive Directory Location

In the case of WebLogic Server 9.2, Beehive samples, ANT scripts, documentation, library JAR files, and other support files are installed on your system under the directory

<WEBLOGIC_HOME>\beehive\apache-beehive-svn-snapshot

This directory had a different name in 9.0 installations, usually

<WEBLOGIC_HOME>\beehive\apache-beehive-incubating-1.0m1

Check all your Ant scripts for references to this directory path and update any references to the old path.

Application Project Model

The project model for Beehive samples shipped with WebLogic Server 9.0, the source-in model, had this form:

      module-name/
          WEB-INF/
              src/

The Beehive samples shipped with WebLogic Server 9.2 are structured according to a different project model, the source-out model. They have this form:

      module-name/
          web/
              WEB-INF/
          src/

If you have a Beehive application that was based on one of the source-in samples, you should still be able to use your current build script, except for possible changes in path names.

However, if you change such an application to conform to the newer source-out model, you may encounter problems when running the Ant macros defined in the import files in

<WEBLOGIC_HOME>\beehive\weblogic-beehive\ant\

To avoid these problems, it will be necessary to copy some of the files in your application to new directories. This should be done as part of your build.xml build script. For guidance in writing the copy instructions appropriately, please see the build script in Beehive Tutorial, in particular, step 6 under the section titled Create a New Page Flow Web Application.

Upgrading from 9.1

If you have Beehive applications that ran under WebLogic Server 9.1, you will have to make certain changes to them so that they will run under WebLogic Server 9.2. This section discusses those changes.

Beehive Directory Location

In the case of WebLogic Server 9.2, Beehive samples, ANT scripts, documentation, library JAR files, and other support files are installed on your system under the directory

<WEBLOGIC_HOME>\beehive\apache-beehive-svn-snapshot

This directory had a different name in 9.1 installations, usually

<WEBLOGIC_HOME>\apache-beehive-1.0-final

Check all your Ant scripts for references to this directory path and update any references to the old path.

Ant Macros

The Ant macros defined in the import files in

<WEBLOGIC_HOME>\beehive\weblogic-beehive\ant\

make certain assumptions about the structure of your application. See Application Project Model for an explanation of the two application models involved.

If your application conforms to the source-out model, it will be necessary to copy some of the files in your application to new directories. This should be done as part of your build.xml build script. For guidance in writing the copy instructions appropriately, please see the build script in Beehive Tutorial, in particular, step 6 under the section titled Create a New Page Flow Web Application.


  Back to Top       Previous  Next