HOW TO: Deploying JSP files to WebSphere Application Server
The information in this article applies to:
- Swiff Chart Generator 2
In this article we walk you through all the steps you must take to run a Java Server Page (JSP) into WebSphere Application Server V4.0 AES.
Overview
About assembly, configuration and deployement on WebSphere Application Server.
How to run Application Assembly Tool (AAT).
About assembly, configuration and deployement on WebSphere Application Server
Running a JSP file into WebSphere Application Server V4.0 AES requires that you first create a new J2EE application from your JSP files. J2EE applications are represented by EAR files (i.e. Enterprise Archive files) that can be deployed in a WebSphere application server. EAR files are standard Java archive files with the .ear file extension. They consist of one or more modules (Web modules, EJB modules etc.), each of these modules contains various types of resources (Java resources such as Java Beans, JAR files, classes etc., static resources such as HTML pages, images, and more).
A module containing JSP files is called a Web module. Web modules are represented by WAR files (i.e. Web Archive files). Like EAR files, WAR files are standard Java archive file with the .war file extension. WAR files are used to store one or more Servlets, JSP files, Java classes, HTML pages etc.
WebSphere Application Server V4.0 AES comes with a tool called Application Assembly Tool (AAT) that helps you to create these files (WAR files and EAR files).
Packaging and installation
To run JSP files into WebSphere Application Server, you will have to follow the 3 steps below:
- Package the JSP files into a WAR file.
- Construct an EAR file containing the WAR file.
- Install the EAR file on WebSphere Application Server.
- Run the JSP application.
1. Package the JSP file into a WAR file.
- Start the Application Assembly Tool (AAT). See How to run Application Assembly Tool.
- Press Cancel at the Welcome to Application Assembly Tool dialog box.
- From the File menu, select New > Web Module.
- From the left pane, select the .war file located on top of the tree and press the right button of the mouse to display the contextual menu.
- From the contextual menu, select Properties.
- From the General tab in the Properties dialog box, type simpleJSP in the Display Name edit box.
- Press OK.
- From the left pane, expand the Files folder.
- From the right pane, select the Resource Files folder and press the right button of the mouse.
- From the contextual menu, select Add Files.
- Press Browse... and navigate to the directory where the JSP files are located. Press Select.
- Select the desired JSP files and press Add.
- Once you have selected all the desired JSP files, press OK.
- Save the .war file. From the File menu, select Save As and enter simpleJSP.war as the file name.
- Close the Application Assembly Tool (AAT) by selecting File > Exit.
2. Construct an EAR file containing the WAR file.
- Start the Application Assembly Tool (AAT). See How to run Application Assembly Tool.
- Press Cancel at the Welcome to Application Assembly Tool dialog box.
- From the File menu, select New > Application.
- From the left pane, select the .ear file located on top of the tree and press the right button of the mouse to display the contextual menu.
- From the contextual menu, select Properties.
- From the General tab in the Properties dialog box, type simpleJSP in the Display Name edit box.
- Press OK.
- From the left pane, select the Web Modules folder and press the right button of the mouse to display the contextual menu.
- From the contextual menu, select Import to navigate to the simpleJSP.war file previously created. Press Open.
- From the resulting dialog box, enter /simplejspsample in the Context root edit box.
Note: The Context root, when combined with the Servlet Mapping defined in the .war file, specifies the URL that users should type in order to access the application. In this case, if accessing the JSP file directly, the URL is:
http://<hostname>/simplejspsample/<the_jsp_file>.jsp
- Press OK.
- Save the .ear file. From the File menu, select Save As and enter simpleJSP.ear as the file name.
- Close the Application Assembly Tool (AAT) by selecting File > Exit.
3. Install the EAR file on WebSphere Application Server
Use the application installer tool to install the previously created EAR file. The application installer tool is located in the installation directory of WebSphere Application Server.
On Windows Systems:
Run the command line and execute the following steps:
cd <WebSphere installation root>\AppServer\bin
SEAppInstall -install <path>\simpleJSP.ear -interactive false
On Unix Systems:
Run the command line and execute the following steps:
cd <WebSphere installation root>/AppServer/bin
SEAppInstall.sh -install <path>/simpleJSP.ear -interactive false
Note: In either case, path is the full pathname of the .ear file.
Remark: Once the EAR archive is installed on WebSphere Application Server, the JSP files are located in the following directory:
<WebSphere installation root>/AppServer/installedApps/simpleJSP.ear/simpleJSP.war/
4. Run the JSP application
Now that the JSP files are correctly installed on WebSphere Application Server, follow the steps below to run the JSP files:
- Restart WebSphere Application Server. To start and stop WebSphere, execute the startserver and stopserver scripts located in <WebSphere installation root>/AppServer/bin.
- Launch your Web Browser and type the following URL:
http://<hostname>/simplejspsample/<the_jsp_file>.jsp
Warning: If your JSP files import classes located in external JAR packages, make sure that:
- the Web Application CLASSPATH is correctly set (refers to the directories where these JAR files are located).
- or these external JAR packages are located in the directories specified in the Web Application CLASSPATH.
For more information, see Setting Classpaths in WebSphere Application Server.
Uninstallation
Use the application installer tool to uninstall Web Applications. The application installer tool is located in the installation directory of WebSphere Application Server.
On Windows Systems:
Run the command line and execute the following steps:
- Stop WebSphere Application Server. To stop WebSphere, execute the stopserver script located in <WebSphere installation root>\AppServer\bin.
cd <WebSphere installation root>\AppServer\bin
SEAppInstall -uninstall simpleJSP
On Unix Systems:
Run the command line and execute the following steps:
cd <WebSphere installation root>/AppServer/bin
SEAppInstall.sh -uninstall simpleJSP
Note: In either cases simpleJSP is the application name entered in the Display name text field of the Properties Dialog Box for the corresponding .ear file.
How to run Application Assembly Tool (AAT)
On Windows systems
You can start the AAT either from the command line or from the Windows Start menu.
- Click the Windows Start button.
- Select Programs > IBM WebSphere > Application Server V4.0 AES > Application Assembly Tool
- or -
- Open up a command line session and set the the PATH and CLASSPATH environment variables.
cd <WebSphere installation root>\AppServer\bin
assembly.bat
On Unix systems
cd <WebSphere installation root>/AppServer/bin
assembly.sh
References: |
Keywords: | JSP WebSphere .ear .war installation |