Here are the steps necessary to deploy the Survey Results application:
-
Compile the Java source files in the SurveyResults directory, or copy the .class files from the
prod folder.
-
Start J2EE and
deploytool.
-
Ensure that the Cloudscape database is started.
Create new application
-
From the menu, select File, New, Application.
-
Browse to the SurveyResults folder.
-
Key SurveyResultsApp.ear in for the file name.
-
Click New Application.
-
Application Display name is SurveyResultsApp by default; click OK.
Create new Enterprise JavaBean component — RockResultsBean
-
Ensure that Application SurveyResultsApp is selected.
-
From the menu, select File, New, Enterprise Bean — Intro display appears; click Next.
-
Select Create New JAR File In Application.
-
Ensure that SurveyResultsApp is selected in the drop-down menu.
-
In JAR Display Name, key SurveyResultsJAR.
-
Click Edit.
-
Select the .class files that comprise the bean. These are:
RockResultsBean.class
RockResultsData.class
RockResultsRemote.class
RockResultsRemoteHome.class
RockSurveyConstants.class
-
Click Add; click OK; click Next.
-
Under Bean Type, click Session and Stateless.
-
In the Enterprise Bean Class combo box, select the bean implementation: RockResultsBean.
-
In Enterprise Bean Name, accept RockResultsBean.
-
Select the corresponding interfaces in the combo boxes:
For Remote Home Interface, select: RockResultsRemoteHome.
For Remote Interface, select: RockResultsRemote.
-
Click Next; click Finish.
-
SurveyResultsJAR and RockResultsBean now appear under SurveyResultsApp.
-
Click the Resource Refs tab; click Add.
-
Under Coded Name, enter "jdbc/gsejbDB". Leave Type as "javax.sql.DataSource", Authentication as "Container", and Sharable checked.
-
Select SurveyResultsJAR, then click the JNDI Names tab.
-
Under EJBs, key ejb/RockResultsBean next to RockResultsBean.
-
Under References, enter "jdbc/gsejbDB" in the JNDI Name column.
Create new Web component
-
Ensure that Application SurveyResultsApp is selected.
-
From the menu, select File, New, Web Component — Intro display appears; click Next.
-
Select Create New WAR File In Application.
-
Ensure that SurveyResultsApp is selected in the drop-down menu.
-
In WAR Display Name, key SurveyResultsWAR.
-
Click Edit.
-
Select the files needed for the component. These are:
The images directory
index.jsp
RockResults.jsp
-
Click Add; click OK; click Next.
-
Select JSP for the type of Web component, then click Next.
-
In the JSP filename combo box, select index.jsp.
-
In Web Component Name, allow the default — index.
-
Click Next. There are no Initialization Parameters. Click Next.
-
Under Component Aliases, click Add, enter "/index" (without quotes).
-
Click Next, then click Finish.
-
SurveyResultsWAR now appears under SurveyResultsApp.
-
Select SurveyResultsWAR, then select the EJB Refs tab and click Add.
-
When the Web client invokes the lookup method, it refers to the home of an enterprise bean like this:
Object objRef = ic.lookup("java:comp/env/ejb/RockResultsBean");
So, in the Coded Name column, enter ejb/RockResultsBean.
-
Accept Session for Type and Remote for Interface.
-
For Home Interface, enter RockResultsRemoteHome.
-
In the Local/Remote Interface column, enter RockResultsRemote.
-
At the bottom, select
ejb-jar-ic.jar#RockResultsBean from the Enterprise Bean Name drop-down menu. Then select JNDI Name and select jb/RockResultsBean from the drop-down menu.
Deployment
- Select SurveyResultsApp.
-
Select Tools, Deploy from the menu.
-
Under Object To Deploy, ensure that SurveyResultsApp is selected.
-
Under Target Server, we are using localhost. Be sure that is selected.
-
Select the Return Client JAR check box.
-
Select Save object before deploying.
-
Click Next.
-
Verify that the JNDI name under both Application and References is ejb/RockResultsBean for RockResultsBean, and "jdbc/gsejbDB" for the Resource Reference. Click Next.
-
Key "/SurveyResults" in the context root.
-
Click Next, then Finish.
-
The Deployment Progress dialog will display. Wait until the progress bars are complete and the Cancel button changes to OK, then click OK.
The SurveyResultsApp application is deployed.
If you look in the SurveyResults folder, you will see that it now contains SurveyResultsApp.ear and SurveyResultsAppClient.jar. To run the SurveyResultsApp, start both J2EE and Cloudscape, then start up your browser and enter http://localhost:8000/Alice. When the Alice's World home page appears, click on the "Alice's Survey Results" link.