Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
fast development
Skill Level: Intermediate
Sing Li (westmakaha@yahoo.com)
Author
Wrox Press
27 Feb 2006
To create, test, and deploy a Web-based application or Web service rapidly, you
need a proven relational database, a standards-compliant Web application server,
and a flexible IDE. Ideally, all these software packages are production-tested, simple
to obtain, easy to use, and well integrated with one another. This tutorial shows you
how to use IBM-backed open source and free software to kick-start your Java™
Web-based application development. You'll learn exactly where to download such
components, install them, and get them working for you today.
This is not a secret, and professionals in large IT projects have been enjoying this
proven collection of software for years. But until recently, the development
community at large has not had general access to these tools. Times have changed,
though, and today full-featured editions of the servers and IDE in this collection are
only a download away — free of charge and free of license fees — with full support
from IBM.
Java developers can now freely use the open source Eclipse IDE to create and test
applications and Web services and then install them to WebSphere Application
Server Community Edition 2.0 (referred to throughout this tutorial as Application
Server), and DB2 Express-C 9.5 for production deployment.
This tutorial takes you along the shortest path to getting these software components
— called the Kick-start your Java apps suite — downloaded and working, letting you
discover their infinite possibilities while creating your next programming masterpiece.
It assists you in installing and setting up the components and reveals how they are
designed to work with one another. Toward this goal, the tutorial does not attempt to
cover all possible features or configuration options available for the individual
packages. You'll be able to discover each product's rich feature set at your own pace
as you continue exploration and development.
connector
• Downloading and installing Eclipse
• Installing the Eclipse Web Tools Platform (WTP) server adapter for
Application Server (formerly called the Application Server plug-in for
Eclipse)
• Managing, browsing, and editing DB2 Express-C 9.5 data through the
Eclipse IDE
• Testing Web applications in Eclipse using existing Application Server
installation
• Rapidly developing and testing a JSP/JSTL Web application in Eclipse,
with data access to DB2 Express-C 9.5, and deploying it to Application
Server
• Configuring Application Server as a general Web server on the Internet
By the end of the tutorial, you'll have hands-on working experience with all the
software tools and have a simple data-driven Java application deployed on
Application Server.
Prerequisites
You should be familiar with Java development in general and server-side Java
development specifically. This tutorial assumes that you understand the general
operations of a relational database and are familiar with basic Java EE concepts,
such as deployment descriptors and WAR archives. Experience working with an
application server and relational database is beneficial but not mandatory.
System requirements
To follow along and try out the code for this tutorial, you need a working installation
of Sun's Java SE JDK 5 update 15 or the IBM SDK for Java Version 5 SR6.
The recommended system configuration for trying out the tutorial is:
• A system supporting the JDK/JRE listed above with at least 1GB of main
memory (2GB recommended)
• At least 2GB of disk space to install the software components and
examples
The instructions in the tutorial are based on a Windows™ operating system. All of
the tools covered in the tutorial also work on Linux® and UNIX® systems.
Section 2. Overview
The Kick-start your Java apps suite of software includes the following products and
versions, which are designed to work well together:
Figure 1 illustrates how these products fit together for server-side Java application
development:
Figure 1. Eclipse, Application Server, and DB2 Express-C 9.5 working together
Your production applications, hosted on Application Server, can use DB2 Express-C
9.5 to store any application data. DB2 Express-C 9.5 supports Java-based data
access through JDBC. It includes a fully licensed, high-performance type 4, 100%
Java JDBC driver. This driver works very well with 100% Java applications requiring
relational database management system (RDBMS) access.
Application Server has built-in support for Java EE Connector Architecture (JCA) 1.5
resource adapters and can make use of the DB2 Express-C 9.5 JDBC driver to
provide data persistence for any hosted application.
introduces DB2 Express-C 9.5, and the following three sections show you how to
download, install, and operate it. If you are already committed to a different database
that you'd like to use with Eclipse and/or Application Server in this tutorial, feel free
to skip these sections.
All the data content and schemas that you create using DB2 Express-C 9.5 are
directly compatible — without the need to perform any conversions — with even the
largest member of the DB2 Universal Database family. Should your data needs grow
in the future, DB2 can grow with your needs.
There is practically no limit to the size of the databases that you can create and
manage with DB2 Express-C 9.5. Depending on your application and database
design, a server equipped with 2GB of main memory can readily handle databases
several gigabytes in size.
A restriction with the free edition of DB2 Express-C 9.5 is the resource utilization,
across all database instances, of two CPU cores and 2GB of memory. An alternative
annual-subscription version is available with a four CPU cores and 4GB limit.
If your needs grow past this range of capacity, the DB2 Universal Database family of
products provides a smooth, scalable growth path without the need to tackle costly
and often risky data conversion.
If you do not yet have an IBM ID, you need to register before downloading DB2
Express-C 9.5. Registration is free and takes just minutes.
Before you proceed any further, you need to be aware that DB2 Express-C 9.5 uses
the operating system's authentication system to authenticate users. In the case of
Windows, it uses the name of the logged-in Windows user. Any tables that you build
in the database are created under a schema with that username. For this tutorial,
make sure you are logged on to Windows as the same user who will create the
application. This eliminates the need to assign a specific level of privileges for your
explorations.
The tabs on the left side link to various IBM informational Web sites. (Make sure you
are connected to the Internet.) Read the installation prerequisites, verify that your
hardware and software satisfy them, and read the release notes. Then click Install
Product.
When prompted, select the Typical installation type, shown in Figure 3. This option
takes up to 800MB of disk space.
The next screen prompts you to save a response file. This file captures all the
options you have selected and is handy if you need to install multiple database
instances or reinstall. The next screen asks for an installation folder. The default is
the Program Files\IBM\SQLLIB\ directory on the system drive. This tutorial refers to
this directory as the SQLLIB directory.
If you use db2admin as the user name, make sure you have created a user with that
name using control panel administration utilities. In the future, when you install
production server instance(s), you should consult the DB2 Administration Server
User Guide to determine the security scenario most applicable to your installation.
• A new green DB2 tray icon (lower right-hand side of the screen next to
the system clock).
• A new menu named IBM DB2 with a variety of administrative and user
tools (under the Windows Start menu).
• The DB2 First Steps window appearing on your desktop, as shown in
Figure 5:
Figure 5. DB2 First Steps window
The application example that you'll work on later in this tutorial (see Creating a Web
application with Eclipse and WTP) makes use of a sample database. The default
DB2 Express-C 9.5 installation creates the sample database as the last step in the
installation, and you do not need create it explicitly. However, if you ever need to
create or re-create this database manually, you can do so by following these steps:
1. Click the Database Creation link on the left-hand side of the First Steps
window.
3. On the next screen, select the default SQL objects and data only option.
Table 1 describes the system services that are installed on your system:
Server
DB2 License Server db2licd Monitors and enforces
DB2 software license
policies.
DB2 Security Server db2sec Authentication server
for clients.
DB2 Remote Command db2rcmd Handles remote
Executor commands for the DB2
instance.
DB2 Database db2dasrrm Provides administration
Administration Server service functionality.
DB2 Management db2mgmtsvc Manages registry for
Service backward compatibility
with earlier versions.
DB2 Fence Mode db2fmp Executes fenced stored
Process procedures and
user-defined functions
outside the engine's
address space (for
security
implementations).
DB2 system tray db2systray Not strictly a service,
manager this provides a tray icon
on the Windows
desktop for quick
access to DB2 utilities.
If you examine the Windows Task Manager's task list (type Ctrl-Alt-Delete to invoke
the Task Manager), you'll see several of these services running.
In Figure 6, the tools for DB2 Express-C 9.5 can be generally classified as
command-line based or GUI-based.
Development support
Java development support in DB2 Express-C 9.5 includes access through JDBC (a
type 4 driver and a type 2 driver are available) and SQLJ static embedded SQL.
Windows .NET developers can use the add-in support for development using the
Microsoft Visual Studio .NET development environment. Open source developers
can take advantage of the support for development using popular scripting
environments, including Perl, PHP, Python, and Ruby.
GUI-based tools
Table 2 briefly describes some of the GUI tools provided with DB2 Express-C 9.5.
You can explore these tools at your leisure:
To start the CLP, select IBM DB2 > DB2COPY1(Default) > Command Line Tools
> Command Line Processor from the Windows Start menu. Alternatively,
assuming you have set up your environment PATH variable to include SQLLIB\BIN,
you can use the following command:
db2
connect to sample
Figure 8 shows the result of this command. You are now connected to the SAMPLE
database:
Figure 8. Connecting to the SAMPLE database through the DB2 Express-C 9.5
CLP
You can directly enter SQL queries against the table. Try the following:
In Figure 9, the result is the record for Philip Smith, who has the employee number
of 000300.
This command shows the fields structure of the EMPLOYEE table, as shown in Figure
10:
The products.sql script file, found in the sql subdirectory of the code download for
this article (see Download), is shown in Listing 1:
Listing 1. The products.sql DB2 CLP script file for creating a table
CONNECT TO SAMPLE;
DROP TABLE PRODUCTS;
CREATE TABLE PRODUCTS (
SKU CHAR(15) NOT NULL,
DESCRIPTION VARCHAR(80) NOT NULL,
PRICE DECIMAL(10,2),
PRIMARY KEY(SKU)
);
INSERT INTO PRODUCTS VALUES('TV1020','70 inch Plasma TV',
1299.00);
INSERT INTO PRODUCTS VALUES('CPU3818','PowerPC CPU',
200.00);
INSERT INTO PRODUCTS VALUES('HDR2929','2 TB Hard Disk',
899.00);
This standard SQL script file connects to the SAMPLE database, creates a table
called PRODUCTS, and places three rows in the table.
The DB2 CLP can process this script. Just enter the following command:
Figure 11. Processing a DB2 command script file using the CLP
You can get more information on the options available with the CLP from the
Information Center. You can also explore the newly created database visually with
the Control Center.
The next section examines another important engine for your Web applications:
WebSphere Application Server Community Edition.
• JSPs
• Servlets
• JavaServer Faces (JSF) components
• Custom Java coding
• EJBs
• POJOs (plain old Java objects) with Java Persistence API (JPA)
persistence support
• Model-view-controller (MVC) frameworks
• Lightweight development frameworks
• JCA 1.5 resource adapters connecting to EIS or legacy systems
• Other data-access components
Once a Geronimo
The Application Server code is based on the popular Apache Geronimo Server
project (see Resources). As such, it comes with the capability to integrate with a
large body of open source technology. Moving forward, Application Server will
continue to support tight integration with best-of-breed open source technology, such
as the Apache Tomcat Web container and the ActiveMQ message broker.
Application Server has built-in support to interoperate with legacy CORBA systems
through the open source Yoko project (see Resources). You can also use it to
deploy and host Web services through its integration with Apache Axis (see
Resources). And you can use Application Server as a general-purpose Web server
to support the serving of static HTML pages and graphical images.
For high-performance service of static Web assets, you can configure the Apache
JServ Protocol version 1.3 (AJP13) protocol connector to enable Application Server
to accept requests from an industry-standard Apache Web server (front end) (see
The AJP protocol).
Table 3 summarizes the open source server components shown in Figure 12:
The corresponding Eclipse WTP server adapter for Application Server (formerly
called the Application Server plug-in for Eclipse) can be downloaded and installed
using the Eclipse update manager. You'll perform those steps later in this tutorial
(see Downloading and installing Eclipse).
To start the server after installation, select IBM WebSphere > Application Server
Community Edition > Start the server from the Windows Start menu.
You should see a command console open that displays the server startup
information, similar to Figure 13:
Figure 13. A system console showing output from the Application Server
startup
To verify the success of the installation, start the Administrative Console by opening
This should bring you to the login page for the Administrative Console. The
Administrative Console is actually a Web application running inside Application
Server. Figure 14 shows the login screen for the console:
Figure 14. The login screen for the Application Server Administrative Console
If you wish to explore the Administrative Console, use the predefined username
(system) and password (manager).
You can also change to the bin directory just below the Application Server
installation directory (or add the bin directory to your PATH environment variable)
and issue this command:
startup
• Log in to the Administrative Console and select Shutdown from its menu
on the left-hand side.
• From the Windows Start menu, select IBM WebSphere > Application
Server Community Edition > Stop the server.
• Change directory to the bin directory just below Application Server
installation directory (or add the bin directory to your PATH environment
variable) and issue this command:
shutdown
You can also issue this command from a command line while you're in the bin
subdirectory:
deploy list-modules
Application Server prompts you for a username and password (use system and
manager). This runs the command-line deployer tool and obtains information on all
the modules deployed on this server. Figure 15 shows the output from a
list-modules command:
In Figure 15, a module name preceded by a plus sign (+) indicates that it is deployed
and running. A module name without the + indicates that it is deployed but not
currently running.
1. Adding the JDBC driver JAR files from the DB2 Express-C 9.5 installation
to the Application Server repository.
2. Creating a database pool using the resource adapter configured with the
JDBC driver.
Add the JDBC driver JAR files from the DB2 Express-C 9.5
installation to the Application Server repository
A JCA 1.5 resource adapter already exists in Application Server that works with the
JDBC driver. However, the DB2 driver distributed as a standard part of Application
Server version 2.0.0.1 is version 9.1, so you need to add the 9.5 JDBC drivers
manually to the Application Server repository. (Later versions of Application Server
will likely include the 9.5 JDBC driver and you may not need to do this.)
The latest version of DB2 Express-C 9.5 comes with the 9.5 JDBC drivers set. You'll
find the following JDBC JARs in the SQLLIB\java directory:
• com.ibm.db2/db2jcc/9.5/jar
• com.ibm.db2/db2jcc_license_cu/9.5/jar
If these entries already exist with your version of the Application Server, you don't
need to do anything more on this screen. Otherwise, add the two JARs from the DB2
Express-C 9.5 SQLLIB\java directory:
1. Enter the path to db2jcc.jar as File (use the Browse button to locate the
JAR file), com.ibm.db2 as Group, db2jcc as Artifact, 9.5 as Version,
and jar as Type.
2. Click Install.
4. Click Install.
Now that you have the JDBC driver files in place, you can use them to create a
database pool.
Click the Create a new database pool: Using the Geronimo database pool
wizard option.
Fill in the details of the pool with the values shown in Table 4. This will involve the
next few screens of the wizard.
9.5 is installed
DB Password Windows user's password for DB2 Express-C 9.5
Port 50000
Database sample
Host localhost
Leave the rest of the configuration empty, accepting the default values, and then
click the Test Connection button. This causes Application Server to attempt to
connect to the SAMPLE database. If the attempt is successful, you should see a
screen similar to Figure 18:
Figure 18. Successful test connect to the DB2 Express-C 9.5 database from
Application Server
1. Click the Show Plan button (see Figure 18). This will display the
generated deployment plan, shown in Listing 2.
If you select Database Pools again on the Administrative Console menu, the display
should now show the dwDatasource pool as a deployed system-wide database
pool. Applications hosted in Application Server can now access the SAMPLE
database by looking up the dwDatasource connection pool.
Figure 19 illustrates the rich features and versatile composition of the Eclipse IDE:
Figure 19. Features of the Eclipse IDE user interface made available to all
plug-ins
Eclipse's all-Java construction lets exactly the same IDE code and IDE user
interface run on any supported OS and hardware platform. Once you become
familiar with the UI and operations of Eclipse, you will be right at home on any
development platform, including UNIX, Linux, Windows, Mac OS X, and others.
Downloading Eclipse
You can download releases of the Eclipse IDE for your platform from the Eclipse
Project Downloads page.
The Eclipse WTP server adapter for Application Server that you'll use for this tutorial
has been tested on Eclipse 3.3 (Europa) and Eclipse WTP 2.0.1. Make sure you
download only the compatible binaries.
Instead of downloading and installing Eclipse, then WTP, then all the dependencies
separately, you can use an all-in-one binary download to save time and avoid
headaches. Follow the links for the latest release at the Web Tools Platform
downloads page to download a compatible version of the all-in-one binaries. The
release version that this tutorial is tested on is based on WTP 2.0.1, and the
download is wtp-all-in-one-sdk-R-2.0.1-20070926042742-win32.zip.
If you look into your distribution directory, you will find an eclipse.exe executable,
which starts Eclipse. You might want to drag-and-drop a shortcut onto your desktop
or the system tray to make future launching of the IDE simpler.
Double-click eclipse.exe or run it on the command line. The IDE should start. After
the splash screen, it prompts you to select a workspace, shown in Figure 20:
Figure 20. Selecting the initial workspace for the Eclipse IDE
A workspace is simply a directory where Eclipse manages source code and other
artifacts for your projects. You can maintain as many projects as you wish in a
workspace. In production projects that use version control, development staff often
needs to work on multiple branches of the same source tree at the same time. You
can use multiple workspaces to work on the different branches. For the purpose of
this tutorial, accept the default to let Eclipse create a new workspace for you.
The IDE starts up with a help screen that lets you walk through the fundamentals of
working with Eclipse, if you wish. Close Eclipse to prepare for the next step.
1. Select Help > Software Updates > Find and Install ... from the Eclipse
menu.
3. Click the New Remote Site button on the top right, and enter the name of
Eclipse WTP server adapter for WAS CE 2.0, and set the URL to
http://download.boulder.ibm.com/ibmdl/pub/software/websphere/wasce/updates/.
4. Expand the selection and make sure you are including only the 2.0 server
adapter — not any of the 1.1 adapters, which have completely different
dependencies.
5. Click Finish and let the update manager download and install the
adapter.
After installation, the download manager might suggest a restart of the Eclipse
environment. Let the update manager restart the environment, and the adapter will
be installed and ready to go.
In the window, select the Connectivity > Data Source Explorer view, as shown in
Figure 21:
A new Data Source Explorer view appears. Right-click the Database element and
select New.... In the New Connection Profile wizard, select Generic JDBC
Connection, and then click the Next button.
Fill in the connection information as shown in Figure 22, pointing to your SAMPLE
database:
Figure 22. Connecting Eclipse to DB2 Express-C 9.5 through the JDBC driver
In Figure 22, note that you need to enter the user ID and password of the Windows
user under which you set up DB2 Express-C 9.5. As you know from Downloading
and installing DB2 Express-C 9.5, it should be your own Windows user ID and
password.
Another important area in Figure 22 is the Select a driver from the drop-down:.
Click ..., select Generic JDBC Connection, and click Next to create a new
connection profile. Name the profile SAMPLE and click Next to select the Database >
DB2 UDB > v9.5 entry. If it does not exist, make a copy of the v9.1 entry and edit it
to reference the DB2 Express-C 9.5 driver files, including db2jcc.jar and
db2cc_license_cu.jar.
You should now be able to click Test Connection, and Eclipse should report that a
ping to the connection is successful. Finally, click Finish. A new SAMPLE
connection appears in the Database Explorer view.
Expand the SAMPLE connection to see your EMPLOYEE and PRODUCTS tables.
Figure 23 shows the expanded PRODUCTS table:
Figure 23. Exploring the SAMPLE DB2 Express-C 9.5 database from Eclipse
You can see how easy it is to access information on DB2 Express-C 9.5 databases
from Eclipse.
Figure 24. Eclipse SQL Results view displaying DB2 Express-C 9.5 table
contents
To see the SQL statement that is executed on the DB2 engine, you can click the
Status tab of the SQL Results view.
Eclipse opens up a database edit view. You can see all the data in the table. You
can change the data in the fields, and you can add new rows to the end of the table.
Figure 25 shows this editable view:
This brings up a wizard that guides you through the DDL generation process. Select
all the check boxes in the wizard's first two screens. The wizard's final screen
previews the generated DDL. For the EMPLOYEE table, it is similar to Listing 3:
"HIREDATE" DATE,
"JOB" CHAR(8),
"EDLEVEL" SMALLINT NOT NULL,
"SEX" CHAR(1),
"BIRTHDATE" DATE,
"SALARY" DECIMAL(9 , 2),
"BONUS" DECIMAL(9 , 2),
"COMM" DECIMAL(9 , 2)
);
...
You can use this DDL to re-create the table on any DB2 database. You can save
this DDL to a file or execute it on a server (perhaps creating the same table in
another database).
The connections and relationships among Eclipse, Application Server, and DB2
Express-C 9.5, illustrated in Figure 26, are key to this scenario:
In Figure 26, Eclipse's Database Explorer and Data Output views are used to access
directly the database schema and content managed in DB2 Express-C 9.5.
Application Server is configured with a JDBC data pool that accesses DB2
Express-C 9.5 databases.
2. Start Eclipse and select File > New > Project... from the application
menu.
Figure 27 shows the wizard used to create a new dynamic Web project.
Figure 27. Creating a new dynamic Web project on the Eclipse IDE
The wizard has also generated two XML files automatically, described in Table 5:
In Figure 28, under the WebContent directory, you can see the standard Java EE
WAR file layout of directories:
Figure 28. Creating a new dynamic Web project in the Eclipse IDE
1. With the WebContent directory highlighted, right-click and select New >
Other....
4. Click Finish.
Eclipse generates a skeletal JSP page from a template. Edit the page to match
Listing 4. Alternatively, you can copy the source from this tutorial's code download
(see Download).
Listing 4. JSP accessing employee data from the DB2 Express-C 9.5 SAMPLE
database
</body>
</html>
This JSP prints out a table of employee information. Each row displayed represents
one employee record maintained in the DB2 Express-C 9.5 EMPLOYEE table.
The coding makes use of only JSP Standard Tag Library (JSTL) tags and
Expression Language (EL); it does not contain any embedded Java code.
Embedded Java code in JSP is often viewed as a bad practice because it tends to
become error-prone and unmanageable in the long term.
The boldfaced lines in Listing 4 show how the <sql:query> tag accesses a JDBC
data source called jdbc/DataSource to execute the SQL SELECT statement. The
result of the query is assigned to the employees variable. Each row of this result is
then displayed using a <c:forEach> iterative tag.
This is standard Java EE flexibility. The deployable application WAR file contains
references to resources (such as a data source) that is resolved only when the
application is deployed. This enables the same code module to be deployed, without
reassembly, on different application servers against different database servers.
Examine the web.xml file that is generated and make sure you add the boldfaced
lines from Listing 5. (You might need to click the Source tab of the Eclipse XML file
editor.) Make sure you save the updated web.xml file.
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<resource-ref>
<res-ref-name>jdbc/DataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
In the geronimo-web.xml file, you make the actual link to the dwDatasource.
Examine the geronimo-web.xml deployment plan in Eclipse. (Click the Source tab of
the deployment plan editor.) Add the boldfaced lines shown in Listing 6 to the
deployment plan and save it:
database pool.
If your Web project requires static content service, just place the static content
starting from the WebContent directory in your Eclipse project.
Right-click the WebContent directory and select New > Other.... From the pop-up
window, select Web > CSS. You'll add a static Cascading Style Sheet (CSS) to the
application to enhance its appearance. Name the stylesheet dwstyles.css and
accept the default template for the stylesheet.
Edit the dwstyles.css file, adding the content in Listing 7. You can also
copy-and-paste from the code distribution (see Download).
h1 {
font-family: arial;
font-size: 38;
align: left;
font-weight: bold;
font-style: italic;
color: green;
}
th {
font-family: verdana, arial;
font-size: 13;
font-weight: bold;
align: left;
background-color: black;
color: white;
}
td {
font-family: verdana, arial;
font-size: 12;
font-style: italic;
align: left;
}
table {
border-style: solid;
border-width: thin;
}
Save the modified stylesheet. When you deploy the application, the stylesheet is
accessible directly, as static content, from Application Server. Your user's browser
accesses this static stylesheet to format the dynamic output from index.jsp.
If the first page of your Web project is static and not dynamically generated, you can
simply add an index.html page to the WebContent directory.
You are now ready to deploy the dwapp application to Application Server.
Right-click the dwapp element in Eclipse's Navigator and select Run as > Run on
Server....
In the Run On Server wizard that opens (shown in Figure 29), select IBM WASCE
v2.0 Server. Make sure you select the check box named Always use this server
when running this project.
Click Next and select the JRE that you are using. (It must be one of the JRE
releases listed in System requirements). Also enter the directory where you have
installed Application Server. This is shown in Figure 30:
Figure 30. Specifying JRE and Application Server runtime for the Eclipse
connected server
Click Finish and wait while Eclipse starts Application Server and deploys the
application to Application Server.
You should see the list of employees displayed on a Web browser window within the
Eclipse IDE, as shown in Figure 31:
The IDE is now connected to Application Server for rapid development and
deployment. At any time during your development cycle, you can deploy your
application to Application Server for testing. If you wish, you can configure the same
Application Server for production. Your application users can then see your
application changes immediately after you deploy the application to the server.
1. Changing the TCP port that the Tomcat (Web connector) listener is
listening to.
Log on to the Application Server Administrative Console and select Web Server on
the left-hand side menu. You'll see three connectors running: one for Secure
Sockets Layer (SSL)-based connections, one for the AJP protocol for connecting to
front-end Web servers, and one for regular Web connections via the HTTP protocol.
Click the edit link next to the HTTP-based TomcatWebConnector. On the next
screen, replace port 8080 with port 80 and click Save. Figure 32 shows the edited
TomcatWebConnector:
Figure 32. Changing the port of the TomcatWebConnector for Internet user
access
Now, shut down the server and restart it. Your Application Server application is now
accessible at http://your WWW domain name/your application name.
Next, to eliminate the need to type the name of the application, you'll modify the
application deployment context to map to the root or /.
For example, if you want to move the dwapp application to the root context, you
need to make the change shown in boldface in Listing 8 to its geronimo-web.xml
plan:
2. Click the Applications > Web App WARs link in the left menu.
The open source Eclipse IDE, the IBM DB2 Express-C 9.5 database, and IBM
WebSphere Application Server Community Edition 2.0 are all your disposal, only a
short click away. This collection of servers and IDEs works well together to make
your design, development, testing, and deployment life simpler.
• Installed and became familiar with DB2 Express-C 9.5, using its rich set of
GUI tools and command-line tools.
• Created database tables with DB2 Express-C 9.5 and queried against
them using SQL commands.
• Installed and worked with WebSphere Application Server Community
Edition, using its Web-based Administrative Console as well as the
command-line deployer tool.
• Connected WebSphere Application Server Community Edition to DB2
Express-C 9.5 by deploying a system-wide database pool to the DB2
database.
• Installed the Eclipse IDE, the supporting Web Tools Platform, and the
Eclipse WTP server adapter for WebSphere Application Server
Community Edition.
• Connected Eclipse to DB2 Express-C 9.5 through Eclipse's versatile
Database Explorer view, which lets you view schema structure, see table
data content, modify data, and generate DDL.
• Used Eclipse to create a Web application and deployed it to WebSphere
Application Server Community Edition with one click, supported through
the Eclipse WTP server adapter for WebSphere Application Server
Community Edition.
• Successfully developed an application on Eclipse, deployed it to
WebSphere Application Server Community Edition, and made the
application use DB2 Express-C 9.5 as its data supplier.
• Configured WebSphere Application Server Community Edition for access
by users over the Internet.
You are now well on your way to developing and deploying your own Web
applications on this powerful collection of software server and tools.
Downloads
Description Name Size Download
method
Sample code for this tutorial j-kickstartcode.zip 4KB HTTP
Resources
Learn
• "DB2 Express-C, the developer-friendly alternative" (Grant Hutchison,
developerWorks, February 2006): Get started quickly using DB2 Express-C for
all of your applications.
• Migrate to DB2 Express-C: Resources to help you get started migrating to DB2
Express-C today.
• Get started now with Eclipse: The developerWorks Eclipse resource page.
• "Manage your Eclipse environment" (Chris Aniszczyk and Phil Crosby,
developerWorks, February 2006): Zen and the art of Eclipse maintenance.
• Migrating to Eclipse: A developer's guide to evaluating Eclipse: Find out how
Eclipse differs from Netbeans, IntelliJ IDEA, and Borland JBuilder.
• "Developing Eclipse plug-ins" (David Gallardo, developerWorks, December
2002): Learn to create, debug, and install your plug-ins.
• WebSphere Application Server Community Edition: Documentation, FAQs,
articles, and more resources.
• Apache Geronimo: The Java EE server from Apache.
• Apache Axis: Apache's reliable and stable base for implementing Java Web
services.
• Apache Tomcat: The Apache servlet container that is used in the official
Reference Implementation for the Java Servlet and JavaServer Pages
technologies.
• Apache Derby: Apache's relational database implemented entirely in Java.
• ActiveMQ: Try out this fast, open source JMS 1.1 provider, which supports
clustering, peer networks, discovery, TCP, SSL, multicast, persistence, and XA
and integrates seamlessly into Java EE 5 containers, lightweight containers,
and any Java application.
• Open EJB: Learn more about this open source, modular, configurable, and
extendable EJB Container System and EJB Server.
• Yoko: An open source Java CORBA server implementation.
Get products and technologies
• WebSphere Application Server Community Edition: Download the application
server.
• DB2 Express-C: Download the database server.
• Eclipse: Download the Eclipse SDK. Get the all-in-one Eclipse binary download
from the Web Tools Platform downloads page.
• Application Server WTP Server Adapter: Follow these step by step instructions
to install the server adapter.
Discuss
• DB2 Express forum
• eclipse.org
• Eclipse newsgroups
• Eclipse developer mailing lists
• developerWorks blogs