J2EE Technology
Lab 1. Tomcat Setup and Configuration, Deploy a
Simple Servlet Application
Lab Works:
(All the applications should be downloadable from the FTP server)
1. Install the Java development environment, including:
a) j2sdk1.5 (D:/jdk1.5.0_09)
2. Tomcat Web Container setup
Install the tomcat version 5.0.19 to D:/tomcat
Environment variables setup
JAVA_HOME: <where the Java JDK installed> i.e. D:/jdk1.5.0_09
(for previous version only!)$CATALINA_HOME: <where the tomcat
installed> i.e. D:/tomcat
Add D:/tomcat/common/lib/servlet-api.jar to CLASSPATH
3. Develop, deploy and run TestingServlet
Follow the instructions in Chapter 3 in the textbook and run TestingServlet
Deploy TestingServelt.class and web.xml
Open up web.xml under <tomcat install directry>/conf, and uncomment
the following part:
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
Lab 1. Tomcat Setup and Configuration, Deploy a Simple Servlet Application -1-
J2EE Technology
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
......
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
Start tomcat
Test your servlet using:
http://localhost:8080/myApp/servlet/TestingServlet
http://localhost:8080/myApp/test
4. Install MS SQL Server 2000
Install MS SQL Server 2000 - Make sure that you use combined user
authentication, and use user name “sa” and password “sa”
Install MS SQL Server 2000 Driver
Copy the driver files mssqlserver.jar, msbase.jar and msutil.jar into
D:/tomcat/common/lib or add the full path of three files to CLASSPATH
5. Installing Stored Procedures for JTA for MS SQL Server
Lab 1. Tomcat Setup and Configuration, Deploy a Simple Servlet Application -2-
J2EE Technology
1. Copy the file sqljdbc.dll from the SQL Server 2000 Driver for JDBC
installation directory to the SQL_Server_Root/binn directory of the database
server for SQL Server.
2. From the server, use the ISQL utility to run the instjdbc.sql script. The system
administrator should back up the master database before running
instjdbc.sql.
At a command prompt, use the following syntax to run instjdbc.sql:
ISQL -Usa -Psa_password -Sserver_name -ilocation/instjdbc.sql
where:
sa_password is the password of the system administrator.
server_name is the name of the server on which SQL Server resides.
location is the full path to instjdbc.sql. This script is located in the SQL Server
2000 Driver for JDBC installation directory.
6. Restore database – Library
Use provided “library” to restore the database named Library into SQL server
2000 database.
7. Install Websphere Application Developer 5.0
Lab 1. Tomcat Setup and Configuration, Deploy a Simple Servlet Application -3-