Listing 5. geronimo-jetty.xml descriptor
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
xmlns="http://geronimo.apache.org/xml/ns/web/jetty"
xmlns:naming="http://geronimo.apache.org/xml/ns/naming"
configId="amazonclient"
parentId="amazonClient">
<context-root>/amazonclient</context-root>
<context-priority-classloader>true</context-priority-classloader>
</web-app>
Now you can save this file as a WAR file called amazon.war. To do so, run the following command
from the amazonclient directory:
jar cf amazon.war
Now you're ready to deploy this code on Geronimo.
Deploy the consumer code on Geronimo
Although you built a standard J2EE WAR file, you could easily deploy this WAR file on any application
server (or servlet engine) that you choose. The next sections show you how to deploy this code on
Geronimo.
Install Geronimo
Begin by downloading and installing Geronimo. (See Resources to link to the download site.)
Download the Geronimo 1.0 M3 Installer. To run the installer, use the following command:
java -jar geronimo-1.0-M3-installer.jar
Follow the steps to install Geronimo into GERONIMO_HOME, defined as C:\geronimo.
Start Geronimo
To start the server, from the GERONIMO_HOME directory, run the following command:
java -jar bin/server.jar
Deploy the Amazon.war file
You should have all the JAR files defined in the setenv batch file in your classpath. Copy the files
from AXIS_HOME\lib into GERONIMO_HOME\lib. Many of these JAR files will already exist in
GERONIMO_HOME\lib. Do not overwrite the files that exist, even if the files you're copying are later versions of the same file. Click No when prompted to replace existing files. To deploy the amazon.war file on the application server, copy the WAR file into GERONIMO_HOME. From this directory, run the following command:
java -jar bin/deployer.jar deploy amazon.war
Run searchAmazon.jsp
The last task left is to run the JSP file you wrote. Open a browser and type http://localhost:8080/
amazon/searchAmazon.jsp in the address bar.
Figure 1 shows the result. You can modify the JSP file to include a form field in which you can enter
an ISBN number and get a result. |