Home TOC |
![]() ![]() ![]() |
Deploying Web Applications
There are several ways to permanently deploy a context to Tomcat; the first two methods require you to restart Tomcat:
1. Select the
- Copy a Web application directory or WAR to
<
JWSDP_HOME
>/webapps
.- Add a context entry to Tomcat's configuration. The format of a context entry is described in the Server Configuration Reference at <JWSDP_HOME>
/docs/tomcat/config/context.html
. For example, here is the context entry for the application discussed in :<Context path="/bookstore1" docBase="../docs/tutorial/examples/web/ bookstore1/build" debug="0">
- There are two ways to add this entry to Tomcat's configuration:
- Copy a configuration file containing the entry to
<
JWSDP_HOME
>/webapps
. A configuration file is named context.xml
. For example, the application configuration file for the application discussed in Chapter 13 is in the filedocs/tutorial/web/bookstore1/bookstore1.xml
.- Add the entry to
<
JWSDP_HOME
>/conf/server.xml
. We don't recommend this method because you can introduce errors intoserver.xml
and Tomcat uses this file during startup. Manual specification of theContext
entry is a limitation of the current release of the Java WSDP. Later releases will include an administration tool that will simplify this task.- Use the
Ant
deploy
task:<deploy url="url" path="path" war="war:example.war!" username="username" password="password" />
- Unlike the
install
task, which can reference an unpacked directory, thedeploy
task requires a WAR. The task uploads the WAR to Tomcat, which then unpacks it into thewebapps
directory and starts the application. You can deploy to a remote server with this task.- With
deploytool
. When you choose thedeploy
operation, it copies the WAR it creates to Tomcat and notifies Tomcat of the new context. You can only deploy tolocalhost
withdeploytool
.
- To deploy the
Hello1
application usingdeploytool
:hello1
WAR.
2. Select ToolsDeploy.
3. Click OK to select the default context path/hello1
.
4. Enter the user name and password that you supplied when you installed the Java WSDP.
5. Click Finish.
6. Dismiss the Deploy Console by clicking Close.
Home TOC |
![]() ![]() ![]() |