|
Tutorial
: Migrating Web Applications from WebSphere
3.5 to WebSphere 4.0
WebSphere
Application Server 4.0 is now J2EE
1.2 compliant. It's a good new because J2EE
is a standard supported by multiples application
servers vendors (BEA, SUN ...).
Web applications structure and deployment descriptor
are standardized as follows :

Figure
1 - myWebApp sample.
WEB-INF/ folder is not accessible by
end user. This folder includes all JAVA classes
(Servlets, JavaBeans...) and all libraries needed
to run the web applications. Deployment information
(Servlets parameters, URL mappings ..) are included
in web.xml. This XML file has to follow the
standardized grammar defined into "SUN's
Web application 2.2 DTD".
/ folder is the document root of the
web application, it is accessible by end user.
It includes static resources (HTML, JavaScript,
CSS, GIF ...) and dynamic resources (JSP).
It's not a flat structure, you could have many
folders and subfolders in.
WAR file is a JAR (like ZIP) file of
the above structure. myWebApp.WAR becomes a
standardized web application that could be easily
deployed under any J2EE 1.2+ compliant application
servers or any SERVLETS 2.2+ engines (Tomcat,
Resin, JRun ...).
With WebSphere Application Server 4.0 (WAS4)
comes a new tool : AAT (Application Assembly
Tool). It allows to create WAR files from non-standard
web applications resources through a few wizards.
Let's
show how to migrate a web application (without
EJB)
from WebSphere 3.5 to 4.0 with the following
tutorial :
For this tutorial we use jChatBox web application
(running under WAS3.5), it's a chat solution
with JSP, JavaBeans, JARs, HTML, CSS, GIF, Applets,
TXT and XML resources.
First of all, download and unzip all files from
jchatbox2.3.zip
(1.6 MB) to a jchatbox/ folder. All JAVA classes
and JavaBeans are included into jchatbox.jar
(do not extract them yet). Most JSP, HTML, CSS,
Applets and GIF files are under skin_*/, admin/,
xml_connector/, applet/, documentation/ folders.
Configuration files (XML, TXT) are under conf/
folder. A dependant library for XML parsing
(Xerces)
is included into xerces.jar (do not extract
them).
- Step
1 : Launch WAS4 Application Assembly Tool
:
and create a new Web Module Wizard :
-
Step 2 : Specify Web Module properties
: Display name, File name, Description.

Wizard 1.
- Step
3 : Add JAVA classes (JavaBeans, Servlets,
...), dependant libraries, JSP and static
resources (HTML, CSS, GIF ...).
Wizard 2.
Click "Add Class Files" and
"Browse" to select jchatbox.jar.
Then select jChatBox entry in the right panel
and click "Add". All class
files will be selected (see bottom panel).
These classes will be extracted to WEB-INF/classes/
folder.

Wizard 3.
Go back to wizard 2. Click "Add Jar
Files" and "Browse"
to select jchatbox/ folder :
Wizard 4.
Then select xerces.jar in the right panel
and click "Add" (xerces.jar
will be moved to WEB-INF/lib/ folder).
Wizard 5.
Go back to wizard 2. Click "Add resources
Files" and "Browse"
to select jchatbox/ folder. Then select all
files and directories except jchatbox.jar
and xerces.jar. These files will be moved
to web application document root.
Wizard 6.
-
Step 4 : Optional properties.
Dot not select "Distribuable" and
click "Next".
- Step
5 : Web icons.
You can select some icons (16x16 or 32x32)
for the web application. They will be displayed
by the WebSphere console. It's not really
useful. Do not select any icons and click
"Next".
- Step
6 : Web components.
You can define here Servlets and JSP parameters
(Name, Class, Init Parameters). However jChatBox
only uses JSP without any parameters.
Click "Next".
- Step
7 : Role list.
You can define role list that will be used
later to protect web resources. For instance
a role could be accountant, reseller, manager,
administrator ... The users/roles mapping
is done when you install the web application
under WAS4.
jChatBox doesn't need role. Click "Next".
- Step
8 : Servlets mapping.
You can define URI mapping for servlets. For
instance, an HelloWorld servlet accessible
from /servlet/test.HelloWorld URI could be
mapped to /helloworld URI.
jChatBox only uses JSP. Click "Next".
-
Step 9 : Resource references.
Defines a reference lookup name to an external
resource. This allows the web application
code to look up a resource by a 'virtual'
name that is wired to the actual location
at deployment time. jChatBox doesn't need
this feature.
Click "Next".
- Step
10 : Context parameters.
You can setup context parameters here. jChatBox
doesn't need one.
Click "Next".
- Step
11 : Error pages.
You can define specific error pages matching
to HTTP error codes (404, 405 ...). We don't
need this feature.
Click "Next".
- Step
12 : MIME mapping.
You can map a file extention with a mime type.
For instance Microsoft word file extension
: "doc" could be mapped to "application/msword"
mime type. Usually you don't need to add one,
the web server should be already setup for
MIME.
Click "Next".
- Step
13 : Tag librairies.
You can define Tag Librairies used in the
web application. jChatbox doesn't use taglibs.
Click "Next".
- Step
14 : Welcome file.
Welcome file will be displayed when you try
to access document root of the web application.
(e.g. : http://www.yourserver.com/jchatbox/).
Click "Add".
Wizard 7.
Browse the web application to select documentation/index.html
Wizard 8.
- Step
15 : EJB References.
EJB Home interfaces could be referenced to
be accessed through "java:comp/env/"
JNDI. jChatBox doesn't use EJBs.
Click "Finish".
- Final
step : Save the WAR file.
File -> Save As : jchatbox.war
Wizard 9 :
AAT.
You can open jchatbox.war with WinZip to check
that the web application structure is standard.
In addition to web.xml, you should notice
two non-standard files : ibm-web-bnd.xmi
and ibm-web-ext.xmi. These XML files
are IBM WAS4-specific, they will be ignored
if you deploy your WAR file in another web
container.
You're now ready to deploy jchatbox.war into
WebSphere Application Server 4.0.
If you want to learn more about jChatBox
(Configuration, Guides ...) then have a look
to the online
documentation.
----
01/16/2002,
JavaZOOM
Team
|