2010/01/11 - Apache Beehive has been retired.

For more information, please explore the Attic.

Apache > Beehive
 

Beehive Sample: NetUI Samples

Introduction

These samples show individual NetUI features, including:

Running the Samples on Tomcat 5

The following explains how to run the samples on Tomcat 5. The sample will run on other web containers, but we have chosen Tomcat 5 for convenience.

To Set up the Environment

Before proceeding, complete all of the necessary and optional steps in the following topic: Beehive Installation and Setup

Open a command shell and confirm that you have set following variables:

  • ANT_HOME
  • JAVA_HOME
  • CATALINA_HOME

Also ensure that the following elements are on your PATH:

  • ANT_HOME/bin
  • JAVA_HOME/bin

To Copy the Application to a Project Folder (Optional Step)

To keep your Beehive distribution directory pristine, you should copy the <BeehiveRoot>/samples/netui-samples folder to another location before proceeding.

Note
<BeehiveRoot> refers to the top-level directory of your Beehive installation. A typical value for <BeehiveRoot> would be /apache/apache-beehive-1.0.

The following instructions assume that you have copied the folder netui-samples into the directory /beehive_projects, resulting in the following directory structure.

/
  beehive_projects
    netui-samples
Note
Strictly speaking, you do not need to copy the netui-samples directory to another location. If you wish to leave the netui-samples directory in place, in the instructions below you must replace occurrences of the path element /beehive_projects with this path element: <BeehiveRoot>/samples.

For example, to build the sample, run the following Ant command:

   ant -f <BeehiveRoot>/samples/netui-samples/src/WEB-INF/build.xml clean build war

To delete the sample's build directory, run the clean target:

   ant -f <BeehiveRoot>/samples/netui-samples/src/WEB-INF/build.xml clean

Edit the build.properties File

In this section you will edit the build.properties file--the file that sets the build-related properties for your web application.

Open the file /beehive_projects/netui-samples/WEB-INF/src/build.properties in a text editor.

Edit the file so that the beehive.home property points to the top-level folder of your beehive installation. For example, if your beehive installation resides at /apache/apache-beehive-1.0, then your build.properties file would appear as follows.

beehive.home=/apache/apache-beehive-1.0

servlet-api.jar=${os.CATALINA_HOME}/common/lib/servlet-api.jar
jsp-api.jar=${os.CATALINA_HOME}/common/lib/jsp-api.jar

context.path=netui-samples
Note
Windows users must use forwardslashes (/) not backslashes (\) in the build.properties file.

To Compile the NetUI Samples Application

To compile the NetUI samples app, enter the following Ant command:

ant 
  -f /beehive_projects/netui-samples/WEB-INF/src/build.xml
  clean
  build
  war

Copy and Paste version:
ant -f /beehive_projects/netui-samples/WEB-INF/src/build.xml clean build war

To Start Tomcat

To start Tomcat, run the following command:

%CATALINA_HOME%\bin\startup.bat

Or, on non-Windows systems,

$CATALINA_HOME/bin/startup.sh

To Deploy to Tomcat

To deploy the samples, copy the WAR file to Tomcat's webapps directory.

On Windows:

copy C:\beehive_projects\netui-samples.war %CATALINA_HOME%\webapps /Y
Note
On Windows, there are file-locking issues that Tomcat versions 5.5.x and above are sensitive to. In particular, any web application that uses Struts will fail to redeploy if you copy in a new .war file as described here. The Commons Digester team is adding a workaround for the issue (see this bug), but in the meantime, you can work around it with the antiResourceLocking option in Tomcat. Just add a file called context.xml in a directory called META-INF inside the web application directory before building (so it will end up as META-INF/context.xml in your controls_tutorial.war):

    <?xml version="1.0" encoding="UTF-8"?>
    <Context antiResourceLocking="true">
    </Context>

Everywhere else:

cp /beehive_projects/netui-samples.war $CATALINA_HOME/webapps

Running

To browse the various feature samples: visit the following link in a browser:

http://localhost:8080/netui-samples