This time, instead of creating everything from scratch, we'll use a copy of the EAR from the Take 2 version and modify it to meet this version's needs. Follow the directions carefully.
-
Compile the Java source files in the Survey3 directory, or copy the .class files from the
prod folder.
-
Start J2EE and
deploytool.
-
Ensure that the Cloudscape database is started.
Create the destination queue
- From the command line, key and execute:
j2eeadmin -addJmsDestination jms/RockSurveyQueue queue
Create new application
-
There is a copy of Survey2App.ear from the Survey2 Directory in the Survey3 directory. Rename it to Survey3App.ear.
-
From the menu, select File, Open.
-
Browse to the Survey3 folder.
-
Select Survey3App.ear.
-
Click Open Object.
-
Application Displays as Survey2App1.
-
Under the General tab, change the Application Display Name to Survey3App.
-
Select Survey2WAR. Under the General tab, change the WAR Display Name to Survey3WAR.
-
Click Edit, then browse to the Survey3 directory.
-
Select the Survey3 files:
The images directory
index.jsp
RockSurvey.jsp
RockSurveyExit.jsp
SurveyWelcome.jsp
-
Click Add. Select "Yes to All" for the overwrite warning.
-
Click OK.
-
Select Survey2JAR. Under the General tab, change the
JAR Display Name to Survey3JAR.
-
Click Edit, browse to the Survey3 directory.
-
Select the all of the .class files in Survey3.
-
Click Add. Select "Yes to All" for the overwrite warning.
-
Click OK.
-
Select RockSurvey2Bean. From the Edit menu, select Delete. Answer Yes to "Are You Sure?"
-
Click Edit. Under Contents of Survey3JAR, Select RockSurvey2Bean.class, then click Remove. Answer Yes to "Are You Sure?" Click OK.
-
Select SurveyNamesBean. Under the General tab, change the Enterprise Bean Name to SurveyNames3Bean.
-
Select SurveyBean. Under the General tab, change the Enterprise Bean Name to Survey3Bean.
Create new Enterprise JavaBean component — RockSurveyMDBean
- Ensure that Application Survey3App is selected.
-
From the menu, select File, New, Enterprise Bean — Intro display appears, click Next.
-
Select Add to Existing JAR File.
-
Select Survey3JAR in the drop-down menu. The RockSurveyMDBean.class file was added above. Click Next.
-
Under Bean Type, click Message-Driven.
-
In the Enterprise Bean Class combo box, select the bean implementation: RockSurveyMDBean.
-
In Enterprise Bean Name, accept RockSurveyMDBean.
-
Click Next, accept Bean Managed Transaction Management.
-
Click Next.
-
For Destination Type, select Queue.
-
For Destination, select jms/RockSurveyQueue.
-
For Connection Factory, select jms/QueueConnectionFactory.
-
Click Next; click Finish.
-
RockSurveyMDBean now appears under Survey3JAR. Select the EJB Refs tab; click Add.
-
In the Coded Name column, enter ejb/SurveyNamesBean.
-
Select Entity for Type and Local for Interfaces.
-
For Home Interface, enter SurveyNamesLocalHome.
-
In the Local/Remote Interface column, enter SurveyNamesLocal.
-
At the bottom, select
ejb-jar-ic.jar#SurveyNames3Bean from the Enterprise Bean Name drop-down menu.
-
Click Add.
-
In the Coded Name column, enter ejb/SurveyBean.
-
Select Entity for Type and Local for Interfaces.
-
For Home Interface, enter SurveyLocalHome.
-
In the Local/Remote Interface column, enter SurveyLocal.
-
At the bottom, select
ejb-jar-ic.jar#Survey3Bean from the Enterprise Bean Name drop-down menu.
-
Select Survey3JAR, then click the JNDI Names tab.
-
Under EJBs, verify that jms/RockSurveyQueue is entered next to ejb/RockSurveyMDBean.
Create new Enterprise JavaBean component — RockSurvey3Bean
- Ensure that Application Survey3App is selected.
-
From the menu, select File, New, Enterprise Bean — Intro display appears; click Next.
-
Select Add to Existing JAR File.
-
Select Survey3JAR in the drop-down menu. The .class file was added above. Click Next.
-
Under Bean Type, click Session and Stateful.
-
In the Enterprise Bean Class combo box, select the bean implementation: RockSurvey3Bean.
-
In Enterprise Bean Name, accept RockSurvey3Bean.
-
Select the corresponding interfaces in the combo boxes:
For Remote Home Interface, select: RockSurveyRemoteHome.
For Remote Interface, select: RockSurveyRemote.
-
Click Next; click Finish.
-
RockSurvey3Bean now appears under Survey3JAR.
-
Select Resource Refs tab; click Add.
-
In the Coded Name field, enter jms/QueueConnectionFactory.
-
For Type, select javax.jms.QueueConnectionFactory.
-
Accept Authentication as Container and check Sharable.
-
In JNDI Name textfield, enter jms/QueueConnectionFactory.
-
Select Resource Env. Refs tab; click Add.
-
In the Coded Name field, enter jms/RockSurveyQueue.
-
For Type, select javax.jms.Queue.
-
In JNDI Name textfield, enter jms/RockSurveyQueue.
-
Select Survey3JAR, then click the JNDI Names tab.
-
Under EJBs, key ejb/RockSurvey3Bean next to RockSurvey3Bean.
-
Verify all other JNDI Name entries.
Modify the Web component
-
Select Survey3WAR, then select the EJB Refs tab and select the "ejb/RockSurveyBean" row.
-
At the bottom, select
ejb-jar-ic.jar#RockSurvey3Bean from the Enterprise Bean Name drop-down menu. Then click the JNDI Name button and select ejb/RockSurvey3Bean from the drop-down menu.
-
Now select Survey3App and click on the JNDI Names tab.
-
Verify that all JNDI Name columns have the proper entries.
Deployment
-
Select Survey3App.
-
Select Tools, Deploy from the menu.
-
Under Object To Deploy, ensure that Survey3App 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 names are correct, then click Next.
-
Key "/Survey3App" 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 Survey3App application is deployed.
If you look in the Survey3 folder, you will see that it now contains Survey3App.ear and Survey3AppClient.jar. To run the Survey3App, 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 Surveys - Take 3" link.