The following sections describe how to deploy, edit, and delete web applications either manually by using the wdeploy command line utility, or through the user interface.
Once deployed, your web applications are enabled by default. To disable a deployed web application manually you would need to modify the server.xml file as follows:
<VS> <WEBAPP uri="/mywebapp" path="/webappdir" enabled = "false" > </WEBAPP> ... </VS>
If you inadvertently deploy or edit more than one web application with the same description, and one of them is disabled, the server will ignore enabled = “false” and continue with default setting of enabled = “true”.
For more information about the server.xml file, see the Sun Java System Web Server 6.1 SP11 Programmer’s Guide to Web Applications.
You can deploy and edit web applications in two ways:
Using Sun Java System Web Server 6.1, you can deploy, edit, delete, disable, and enable web applications for a specified virtual server.
You can access the Deploy Web Applications page by selecting Deploy Web Applications under the Web Applications tab of the Virtual Server Manager.
To deploy a web application, perform the following steps.
Select Local Machine or Server Machine from the WAR File On drop-down list.
Select Local Machine when uploading a WAR file to your server. Select Server Machine when the WAR file already resides there.
Enter the path on the local or server machine to the WAR file containing the web application in the field provided.
On server machines enter the absolute path to the WAR file.
On local machines you can browse the available paths. Clicking browse bring up the File Upload window, allowing you to select the WAR file to upload to your server.
Enter the URI on the virtual server for the web application in the field provided.
Enter the absolute path to the directory on the server machine into which the contents of the WAR file will be extracted. If the directory does not exist, one will be created.
Click OK.
Click Apply.
Select Dynamic Reconfiguration for your web application to be deployed.
You can edit, delete, disable, or enable an already deployed web application. Access the Edit Web Applications page by selecting Edit Web Applications under the Web Applications tab of the Virtual Server Manager.
To edit, delete, disable, or enable an already deployed web application, follow these steps
Select the action you wish to perform from the drop-down list in the Action column next to the web application you are editing. Choose:
Edit to change the URI where the web application can be accessed.
Delete to delete the web application entry from the web applications file and delete the directory where the application is deployed.
Disable to make the web application inaccessible from the URI, but not delete it.
Enable to reactivate web applications that were previously disabled.
Deleting a web application also deletes the directory the application is deployed in.
(Optional) Enter a new URI in the URI field if you are editing the web application.
Click OK.
Click Apply.
Select Dynamic Reconfiguration for your web application to be deployed.
Before you can deploy a web application manually, you must make sure that the server_root/bin/https/httpsadmin/bin directory is in your path and that the IWS_SERVER_HOME environment variable is set to your server_root directory.
You can use the wdeploy utility at the command line to deploy a WAR file into a virtual server web application environment:
wdeploy deploy -u <uri_path> -i <instance> -v <vs_id> [ [-V <verboseLevel>]| [-q] ] [-n] [-d <directory>] <war_file>
wdeploy delete -u <uri_path> -i <instance> -v <vs_id> [ [-V <verboseLevel>] | [-q] ] [-n] hard|soft
wdeploy list -i <instance> -v <vs_id> [ [-V <verboseLevel>] | [ -q] ]
The command parameters have the following meanings:
The URI prefix for the web application. |
|
The server instance name. |
|
The virtual server ID. |
|
directory |
(optional) The directory to which the application is deployed, or from which the application is deleted. If not specified for deployment, the application is deployed to the document root directory. |
hard | soft |
Specifies whether the directory and the server.xml entry are deleted (hard) or just the server.xml entry is deleted (soft). |
war_file |
The WAR file name |
verboseLevel |
The verbose level to display the log messages on console. The value can range from 0 to 4. The default value is 1. Note that in Sun Java System web Server 6.1, the loglevel attribute of the LOG element in server.xml is used in lieu of this element. |
-q |
(quiet) Sets the verbose level to zero. It is equivalent to the setting -V 0. |
-n |
prevents wdeploy from automatically sending the reconfigure command to the web server. For more information, see Using -n in the wdeploy Command. |
If you deploy a web application and do not specify a directory, the application is deployed to the document root directory. If you then delete the application using the hard parameter, the document root directory will be deleted.
When you execute the wdeploy deploy command, three things happen:
A web application with the given uri_path and directory gets added to the server.xml file.
The WAR file gets extracted at the target directory.
The server is dynamically reconfigured to load the new web application.
For example:
wdeploy deploy -u /hello -i server.sun.com -v acme.com -d /s1ws61/https-server.sun.com/acme.com/web-apps/hello /s1ws61/plugins/servlets/examples/web-apps/HelloWorld/ HelloWorld.war
This utility results in the following server.xml entry:
<VS> <WEBAPP uri="/hello" dir="/s1ws61/https-server.sun.com/acme.com/webapps/hello"> </VS>
The /s1ws61/https-server.sun.com/acme.com/web-apps/hello directory has the following contents:
colors index.jsp META-INF WEB-INF/ web.xml /classes/ HelloWorldServlet.class HelloWorldServlet.java SnoopServlet.class SnoopServlet.java
In Sun Java System Web Server 6.1, after deploying or deleting a web application, wdeploy dynamically reconfigures the server, causing the server to load or unload the web application that was deployed or deleted. Previously, you had to explicitly reconfigure the server in order for your changes to take effect by doing one of the following:
Using the reconfig script
Restarting the server
Clicking the Apply link in the Administration User Interface.
Now a successful wdeploy command will automatically be enabled to service requests for a new web application, or to stop servicing requests for a deleted web application.
The -n option prevents wdeploy from automatically sending the reconfigure command to the web server. Use the -n option in your command when deploying or undeploying multiple web applications (in a script for example), and you want to reconfigure the server only once after the last web application is deployed.
After you have deployed an application, you can access it from a browser as follows:
http://vs_urlhost[:vs_port]/uri_path/[index_page]
The parts of the URL have the following meanings:
One of the urlhosts values for the virtual server. |
|
(optional) Only needed if the virtual server uses a non-default port. |
|
The same one you used to deploy the application. This is also the context path. |
|
(optional) The page in the application that end users are meant to access first. |
http://acme.com:80/hello/index.jsp
or:
http://acme.com/hello/
The wdeploy option returns following exit values:
0: Indicates that the wdeploy option was executed successfully.
1: Indicates that an error occurred while executing the wdeploy option due to invalid command line arguments or invalid content of the configuration files.
2: Indicates that the error is due to operating system settings. Either the specified directory doesn’t exist or the file permission is not set.