3.5.  Enable and use Monitored Directory for application deployment.

[Note]

Using a monitored directory

With WebSphere Application Server V8, you can deploy or update applications automatically by copying an application archive to a specified, monitored directory. Monitored directories support the following types of applications:

The monitored directory feature is disabled by default.

For stand-alone servers, the following directory is used:

profile_root/monitoredDeployableApps/servers/server_name
					

For distributed systems, the following directories are used:

Figure below shows a cell topology with one node (exampleNode01). The node has one stand-alone server (server1).

Figure 3.4. Local Topology

Local Topology


test317:/opt/IBM/WebSphere/AppServer/profiles/Dmgr01 # mkdir -p monitoredDeployableApps/nodes/exampleNode01/servers/server1
test317:/opt/IBM/WebSphere/AppServer/profiles/Dmgr01 # mkdir -p monitoredDeployableApps/servers/server1
test317:/opt/IBM/WebSphere/AppServer/profiles/Dmgr01 # chmod -R 777 monitoredDeployableApps/
					

Figure below illustrates the monitored directory structure for the topology shown above. The directories marked with red ovals are the directories where you can copy an application to deploy it on specified run time.

Figure 3.5. Sample monitored directory structure

Sample monitored directory structure


Setting up a monitored directory

To enable and set up the monitored directory in WebSphere Application Server, complete the following steps:

  1. In the administrative console, click Applications > Global deployment settings.

  2. Select the Monitor directory to automatically deploy applications option, as illustrated in figure below. You can also change the default location of the monitored directory in the Monitored directory field.

    Figure 3.6.  Configuring the monitored directory

    Configuring the monitored directory


    Important: the WebSphere Application Server will not create a configured monitored directory for you. It must already exist on the system.

  3. To change the standard polling interval setting, specify a number of seconds in the Polling interval field. Note that minimum value is 5 seconds. If you specify a lower or negative value, WebSphere Application Server will use 5 seconds automatically.

  4. Click Apply to save the configuration.

Also, you can use wsadmin.sh scripting to set monitored directory values:

test317:~ # /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/wsadmin.sh -lang jython
WASX7209I: Connected to process "dmgr" on node test317CellManager01 using SOAP connector;  The type of process is: DeploymentManager

WASX7031I: For help, enter: "print Help.help()"
wsadmin>
wsadmin>c1 = AdminConfig.getid('/Cell:test317Cell01/')
wsadmin>md = AdminConfig.showAttribute(c1, "monitoredDirectoryDeployment")
wsadmin>AdminConfig.modify(md, [['enabled', "true"]])
''
wsadmin>print AdminConfig.show(md)
[enabled true]
[monitoredDirectory ${USER_INSTALL_ROOT}/monitoredDeployableApps]
[pollingInterval 5]
wsadmin>AdminConfig.save()
''
wsadmin>
					

Working with a monitored directory

When an application is copied into the monitored directory, WebSphere Application Server creates a temporary copy of that application in another directory and installs it on the server. If you copy an application with a name that is already deployed on the server, it will be updated.

The monitored directory works only when the application server or cluster is running.

NOTE: Installing an EAR, JAR, WAR, or SAR file by adding it to a monitored directory does not change existing Java Naming and Directory (JNDI) or other application bindings. If you need to set binding values during deployment, install the file using the administrative console application installation wizard, a wsadmin.sh script, or a properties file that sets the bindings.

Professional hosting         Free 'Oracle Certified Expert Web Services Developer 6' Guide     Free SCDJWS 5.0 Guide