24
Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 By Gilbert Herschberger (http://www.mindspring.com/~gchii/) Date Written : 6 April 2010 Goal In this exercise, we will download and install Apache Tomcat 6.0 (Tomcat) with EGL Community Edition (EGL-CE). We will start and stop the server to confirm that Tomcat can be used with EGL-CE. Once installed, a Tomcat server can be reused. One installation of Tomcat can be shared by multiple workspaces created with EGL-CE. One installation of Tomcat can be shared by multiple Eclipse-based IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. Other exercises include: Exercise 9.1 - Ping EGL Web Service. In this exercise, create your first EGL web service and reduce the size of your web application by removing unused bits. This exercise features EGL Community Edition and Apache Tomcat 6.0. Target Runtime Environment For this exercise, the target runtime server is an application server. Apache Tomcat 6.0 Target Development Environment For this exercise, the following software is part of the development environment. EGL Community Edition 1.0 Apache Tomcat 6.0 Exercise overview Use the following procedures to use EGL-CE with Tomcat. 1. Start your IDE 2. Stop your IDE 3. Preparing your workspace 4. Download and install Tomcat – downloading and installing Tomcat for the first time 5. Removing a server document 6. Connecting a workspace of EGL-CE to Tomcat - connecting a workspace of EGL-CE to a pre- existing installation of Tomcat 7. Starting Tomcat 8. Restarting Tomcat 9. Stopping Tomcat Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 1

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

  • Upload
    doandat

  • View
    216

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0By Gilbert Herschberger (http://www.mindspring.com/~gchii/)Date Written : 6 April 2010

GoalIn this exercise, we will download and install Apache Tomcat 6.0 (Tomcat) with EGL Community Edition (EGL-CE). We will start and stop the server to confirm that Tomcat can be used with EGL-CE.

Once installed, a Tomcat server can be reused. One installation of Tomcat can be shared by multiple workspaces created with EGL-CE. One installation of Tomcat can be shared by multiple Eclipse-based IDEs, such as EGL-CE and Rational Business Developer (RBD).

SeriesThis document is part of an education and training series. Other exercises include:

● Exercise 9.1 - Ping EGL Web Service. In this exercise, create your first EGL web service and reduce the size of your web application by removing unused bits. This exercise features EGL Community Edition and Apache Tomcat 6.0.

Target Runtime EnvironmentFor this exercise, the target runtime server is an application server.

● Apache Tomcat 6.0

Target Development EnvironmentFor this exercise, the following software is part of the development environment.

● EGL Community Edition 1.0● Apache Tomcat 6.0

Exercise overviewUse the following procedures to use EGL-CE with Tomcat.

1. Start your IDE2. Stop your IDE3. Preparing your workspace4. Download and install Tomcat – downloading and installing Tomcat for the first time5. Removing a server document6. Connecting a workspace of EGL-CE to Tomcat - connecting a workspace of EGL-CE to a pre-

existing installation of Tomcat7. Starting Tomcat8. Restarting Tomcat9. Stopping Tomcat

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 1

Page 2: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

PrerequisitesThe following are prerequisites for this exercise.

1. EGL Community Edition has been installed.2. Apache Tomcat 6 has not been downloaded; it has not been installed.

Procedure 1: Start your IDEThe following procedure illustrates how to start EGL-CE.

1. Start your interactive development environment (IDE).

1. For Microsoft Windows, double-click the EGL-CE 1.0 ( ) icon on your Windows desktop to start your IDE.

2. Switch to the “eglws” (EGL Web Services) workspace.

1. For Microsoft Windows, type “C:\lab\eglws” in the directory field.

2. Press the OK button.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 2

Page 3: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

Procedure 2: Stop your IDEThe following procedure illustrates how to stop your IDE.

1. Switch to the EGL perspective, if necessary.

2. Switch to the Servers view.

3. Stop each server, if necessary. Caution: Unlike Tomcat, some servers, such as WebSphere, do not stop when you stop your IDE.

4. Pull down the File menu and select the Exit option.

Procedure 3: Preparing your workspace1. Start your IDE.

2. Close the Welcome view, if necessary.

1. Press the Close (X) icon on the Welcome view tab.

3. Switch to the EGL perspective, if necessary.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 3

Page 4: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 4

Page 5: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

4. By default, Tomcat listens for web service requests on port 8080. When generating a web services description language (WSDL) file, EGL in EGL-CE uses the server document.

Caution: Unlike Rational Business Developer (RBD), EGL-CE ignores the preference called “service port for WSDL generation”. In RBD, this setting is important for generating SOAP web services for Tomcat. When generating a WSDL file, EGL in RBD uses workspace preferences, ignoring the server document.

1. Pull down the Window menu and select the Preferences option.

2. Expand the EGL folder.

3. Select the Service preferences.

4. Confirm the WSDL Document Style/Encoding field is “Document-Literal/Wrapped”.

5. Confirm the service host is “localhost”.

6. Type “8080” in the Port field.

7. Press the OK button.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 5

Page 6: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

5. Confirm the Build Automatically feature is enabled.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 6

Page 7: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

Procedure 4: Downloading and installing TomcatUse this procedure when Tomcat has not been installed on a machine, or you want to create a separate installation of Tomcat server. The following procedure illustrates how to download and install Tomcat using “C:\lab\tomcat6” as the target installation directory.

1. Start your IDE.

2. Switch to the EGL perspective, if necessary.

3. Switch to the Servers view. The Servers view displays a list of servers used by projects in this workspace. Note: Unlike Rational Business Developer (RBD), a workspace for EGL-CE does not automatically configure servers installed with IBM Installation Manager.

4. Right-click in the white space of the Servers view and select the New | Server option.

5. Result: The New Server wizard is displayed.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 7

Page 8: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

6. Fill in the Define a New Server page of the New Server wizard.

1. Confirm the Server's host name field is “localhost”.

2. Expand the Apache folder.

3. Select Tomcat v6.0 Server.

4. Confirm the Server name field is “Tomcat v6.0 Server at localhost”.

5. Press the Next button.

6. Result: The Tomcat Server page is displayed.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 8

Page 9: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

7. Press the Download and Install button in the Tomcat Server page of the New Server wizard.

8. Result: The Download and Install wizard is displayed.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 9

Page 10: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

9. Fill in the Feature License page of the Download and Install wizard.

1. Review the terms of the license.

2. Select the I accept the terms of the license agreement option.

3. Press the Finish button.

4. Result: The Brows for Folder dialog box is displayed.

10. Fill in the Browse for Folder dialog box.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 10

Page 11: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

1. Navigate to the lab directory.

2. Press the Make New Folder button.

3. Type “tomcat6” in the Folder field.

4. Select the “tomcat6” folder.

5. Press the OK button.

6. Result 1: The Tomcat Server page of the New Server wizard is displayed with the following message: “The Tomcat installation directory is not valid. It is missing expected file or folder lib/jasper-el.jar.”

7. Result 2: The Status bar is displayed in the IDE window. (You may need to move the New Server window to see it.)

8. Result 3: Apache Tomcat 6 is downloaded from the Internet.

9. Result 4: Apache Tomcat 6 is installed.

11. Wait until the download and install process is complete.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 11

Page 12: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

12. Confirm the success of the Download and Install process (and remove the error message).

13. Press the Browse button in the Tomcat Server page of the New Server wizard.

1. Result: The Browse for Folder dialog box is displayed.

2. Expand the “tomcat6” directory.

3. Confirm the directories exist as shown.

4. Press the OK button.

5. Result: The Tomcat Server page is displayed without an error message.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 12

Page 13: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

14. Fill in the Tomcat Server page of the New Server wizard.

1. Confirm the Name field is “Apache Tomcat v6.0”.

2. Confirm the Tomcat installation directory field.

3. Confirm the JRE field is “Workbench default JRE”.

4. Press the Next button.

5. Result: The Add and Remove Projects page is displayed.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 13

Page 14: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

15. Fill in the Add and Remove Projects page of the New Server wizard.

1. Press the Finish button.

2. Result: The Tomcat v6.0 Server at localhost document is added to the Servers view.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 14

Page 15: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

16. Confirm the Servers view now shows a server document for Tomcat v6.0 Server at localhost as shown.

17. Review the server document.

1. To open the document, right-click on the Apache Tomcat v6.0 Server at localhost document and select the Open option.

2. Explore the contents.

1. For example, the HTTP/1.1 port. When generating a web service description language (WSDL) file, for example, this port setting is used.

3. Close the document.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 15

Page 16: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

Procedure 5: Removing a server documentDeleting a server document does not delete the server software. Rather, it removes a connection between your workspace and a server. The following procedure illustrates how to delete a server document, using Apache Tomcat 6.0 Server as an example.

1. Start your IDE.

2. Switch to the EGL perspective, if necessary.

3. From the Servers view, right-click on the Tomcat v6.0 Server at localhost document and select the Delete option.

4. Result: The Delete Server dialog box is displayed.

5. Fill in the Delete Server dialog box.

1. Confirm the Delete unused server configuration(s) field is checked.

2. Press the OK button.

3. Result: The server document is deleted.

6. Confirm the Servers view does not show a server document.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 16

Page 17: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

Procedure 6: Connecting a workspace of EGL-CE to TomcatUse this procedure for each workspace. The following procedure illustrates how to add a server document, using Apache Tomcat 6.0 Server as an example.

1. Start your IDE.

2. Switch to the EGL perspective, if necessary.

3. Switch to the Servers view. The Servers view displays a list of servers used by projects in this workspace.

4. Right-click in the white space of the Servers view and select the New | Server option.

5. Result: The New Server wizard is displayed.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 17

Page 18: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

6. Fill in the Define a New Server page of the New Server wizard.

1. Confirm the Server's host name field is “localhost”.

2. Expand the Apache folder.

3. Select Tomcat v6.0 Server.

4. Confirm the Server name field is “Tomcat v6.0 Server at localhost”.

5. Press the Next button.

6. Result: The Tomcat Server page is displayed.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 18

Page 19: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

7. Press the Browse button in the Tomcat Server page of the New Server wizard.

1. Result: The Browse for Folder dialog box is displayed.

2. Navigate to the lab directory.

3. Select the “tomcat6” directory.

4. Press the OK button.

5. Result: The Tomcat Server page is displayed.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 19

Page 20: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

8. Fill in the Tomcat Server page of the New Server wizard.

9. Confirm the Name field is “Apache Tomcat v6.0”.

10. Confirm the Tomcat installation directory field.

11. Confirm the JRE field is “Workbench default JRE”.

12. Press the Next button.

13. Result: The Add and Remove Projects page is displayed.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 20

Page 21: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

14. Fill in the Add and Remove Projects page of the New Server wizard.

1. Press the Finish button.

2. Result: The Tomcat v6.0 Server at localhost document is added to the Servers view.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 21

Page 22: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

15. Confirm the Servers view now shows a server document for Tomcat v6.0 Server at localhost as shown.

16. Review the server document.

1. To open the document, right-click on the Apache Tomcat v6.0 Server at localhost document and select the Open option.

2. Explore the contents.

3. Close the document.

Procedure 7: Starting TomcatThe following procedure illustrates how to start a server, using Tomcat as an example.

1. Start your IDE.

2. Switch to the EGL perspective.

3. From the Servers view, select the server called “Apache Tomcat v6.0 Server at localhost”.

4. Press the Start ( )icon.

5. Result 1: The Start icon starts a launcher.

6. Result 2: In turn, the launcher starts Tomcat.

7. Result 3: The Servers view displays Started and Synchronized.

● Best Practice: Do not proceed with your development project until Tomcat starts. Do not import

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 22

Page 23: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

a Tomcat-dependent project from a Project Interchange File until Tomcat starts.

● Note: Sometimes, removing the server document (Procedure 4) and adding it again (Procedure 5) can eliminate certain errors and allow Tomcat to start.

Procedure 8: Restarting TomcatThe following procedure illustrates how to restart Tomcat.

1. Switch to the EGL perspective, if necessary.

2. From the Servers view, select the server called “Tomcat v6.0 Server at localhost”.

3. Press the Start ( )icon.

4. Result 1: The Start icon sends a polite request to Tomcat, asking it to stop itself.

5. Result 2: Tomcat stops.

6. Result 3: The Start icon starts a launcher.

7. Result 4: In turn, the launcher starts Tomcat.

8. Result 5: The Servers view displays Started and Synchronized.

Procedure 9: Stopping TomcatThe Apache Tomcat v6.0 Server stops automatically when you close your IDE. The following procedure illustrates how to stop Tomcat using EGL-CE.

Caution: Unlike Tomcat, some servers, such as WebSphere, do not stop when you stop your IDE.

1. Start your IDE

2. Switch to the EGL perspective.

3. From the Servers view, select the server called “Tomcat v6.0 Server at localhost”.

4. Press the Stop ( ) icon.

5. Result 1: The Stop icon sends a polite request to Tomcat, asking it to stop itself.

6. Result 2: Tomcat stops.

7. Result 3: In the Servers view, the state is Stopped.

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 23

Page 24: Exercise 3.1 – EGL-CE 1.0 and Tomcat 6 · IDEs, such as EGL-CE and Rational Business Developer (RBD). Series This document is part of an education and training series. ... For example,

Exercise 3.1 – EGL-CE 1.0 and Tomcat 6.0 24