Monitored Deployment/Auto-deployment

advertisement
Chapter
5
WebSphere Application Server v8
Primer
By
Joseph Amrith Raj
Monitored Deployment/Auto-deployment
2
JOSEPH’S WEBSPHERE LIBRARY
WebSphere Application Server v8
Primer, part-5: Monitored deployment /
Auto-deployment
 WebSphere Library
http://webspherelibrary.mp
http://facebook.com/webspherelibrary
Joseph’s WebSphere Library
Monitored Deployment/Auto-deployment
3
Table of Contents
Monitored Directory ..................................................................................................................................... 4
Settings.......................................................................................................................................................... 4
Deployment .................................................................................................................................................. 5
UnDeployment .............................................................................................................................................. 6
Final comments: ............................................................................................................................................ 7
Next Steps: .................................................................................................................................................... 7
References .................................................................................................................................................... 8
About Author ................................................................................................................................................ 9
Connect With US ......................................................................................................................................... 10
Joseph’s WebSphere Library
Monitored Deployment/Auto-deployment
4
In WebSphere Application Server v8, you can specify a deployment directory location which websphere
can monitor and do deployments.
Monitored Directory
Monitor Directory specifies whether to enable monitored directory deployment. You can use monitored
directory deployment to install or update an enterprise application file on an application server or cluster,
or to uninstall an application file that was previously installed using monitored directory deployment. You
can install or update an application file by dragging or copying an EAR, WAR, JAR, SAR to a monitored
directory. The application file must conform to the Java Platform, Enterprise Edition (Java EE)
specification. To uninstall a deployed application file, remove it from the monitored directory.
This sound like the „webapps‟ directory of the tomcat server to me, at this moment. Now, let us see how it
works.
Settings
By default, this option is disabled. To enable, go to Applications –>Global Deployment Settings
1. Monitor Directory to automatically deploy application – must select to enable the option.
2. Monitored Directory – Directory where you will place your deploy-able files and websphere should
monitor
For base (stand-alone) application servers, the default monitored directory is the
monitoredDeployableApps/servers/server_name directory of the application server
profile.
For deployment managers, the
default monitored
directories
monitoredDeployableApps/servers/server_name,
monitoredDeployableApps/nodes/node_name/servers/server_name,
Joseph’s WebSphere Library
are
the
Monitored Deployment/Auto-deployment
5
and monitoredDeployableApps/clusters/cluster_name directories of the deployment
manager profile.
3. Polling interval – Specifies the number of seconds that elapse before the WebSphere scans a
monitored directory for new applications. Default is 5 seconds.
4. Click apply, save change and restart server [ before restart nothing happened in the monitored
directory ]

For base (stand-alone) application servers, the default monitored directory is the
monitoredDeployableApps/servers/server_name directory of the application server profile.

For
deployment
managers,
the
default
monitored
directories
monitoredDeployableApps/servers/server_name,
monitoredDeployableApps/nodes/node_name/servers/server_name,
and monitoredDeployableApps/clusters/cluster_name directories of the
manager profile.
are
the
deployment
I‟ve changed the Monitored directory to {USER_INSTALL_ROOT}/Autodeploy. Created „AutoDeploy‟
directory under C:/IBM/WWebSphere8/profiles/AppServer01 [this is my USER_INSTALL_ROOT]. then
restarted server. Now i can see 2 new directories under {USER_INSTALL_ROOT}/Autodeploy with
names deployment properties and Servers. Under servers directory i‟ve another directory with name
server1 which is actually my server name. So the directory that is now being monitored by WebSphere is
”{USER_INSTALL_ROOT}/Autodeploy/servers/server1“
Deployment
Ok.. Now let’s do a deployment. for the testing purpose i took cachemonitor.war from „installableApps‟
and
placed
it
in
the
monitored
directory.
After 5 seconds.. i can see the following update in my SystemOut.log
[4/25/11 11:59:45:538 PDT] 00000022 WatchService I CWLDD0007I: Event id 1924194575-1.
Start of processing. Event type: Added, File path:
C:\IBM\WebSphere8\profiles\AppSrv01\AutoDeploy\servers\server1\CacheMonitor.ear.
[4/25/11 11:59:46:273 PDT] 00000022 AppManagement I CWLDD0028I: Event id 19241945751. The target of the current operation is
[WebSphere:cell=josephNode01Cell,node=Node01,server=server1].
[4/25/11 11:59:46:304 PDT] 00000022 AppManagement I CWLDD0014I: Event id 19241945751. Installing application Dynamic Cache Monitor…
[4/25/11 11:59:48:741 PDT] 00000023 webcontainer I
com.ibm.ws.webcontainer.internal.WebContainer addExtensionFactory SRVE0239I: Extension
Joseph’s WebSphere Library
Monitored Deployment/Auto-deployment
6
Factory [class com.ibm.ws.soa.sca.web.extension.SCAWebExtensionFactory] was registered
successfully.
[4/25/11 11:59:48:741 PDT] 00000023 webcontainer I
com.ibm.ws.webcontainer.internal.WebContainer addExtensionFactory SRVE0240I: Extension
Factory [class com.ibm.ws.soa.sca.web.extension.SCAWebExtensionFactory] has been associated
with patterns [""].
[4/25/11 11:59:48:788 PDT] 00000023 WebSphereSCAS I Added Servlet mapping: /dojo
[4/25/11 11:59:48:788 PDT] 00000023 WebSphereSCAS I Added Servlet mapping: /dojo
[4/25/11 11:59:48:788 PDT] 00000023 WebSphereSCAS I Added Servlet mapping: /tuscany
[4/25/11 11:59:48:788 PDT] 00000023 WebSphereSCAS I Added Servlet mapping: /tuscany
[4/25/11 11:59:49:538 PDT] 00000023 InstallSchedu I ADMA5013I: Application Dynamic Cache
Monitor installed successfully.
This clearly says that the deployment is successful. Now go to Applications –> Application Types –>
websphere enterprise applications in the admin console. I can see the dynamic cache monitor deployed
ans started successfully. Another thing i noticed here is it generated [updated] the plugin-cfg.xml and
propagated it to my Web Server [IHS].
UnDeployment
Now that deployment is successful.. Let’s test the UnDeployment. Just remove the application EAR file
from monitored directory and wait for 5 sec [polling interval]
[4/25/11 12:06:56:268 PDT] 00000022 WatchService I CWLDD0007I: Event id 1924194575-2. Start of
processing. Event type: Deleted, File path:
C:\IBM\WebSphere8\profiles\AppSrv01\AutoDeploy\servers\server1\CacheMonitor.ear.
[4/25/11 12:06:57:002 PDT] 00000022 AppManagement I CWLDD0028I: Event id 1924194575-2. The
target of the current operation is [WebSphere:cell=jpaturiwxp03Node01Cell,node=Node01,server=server1].
[4/25/11 12:06:57:018 PDT] 00000022 AppManagement I CWLDD0023I: Event id 1924194575-2.
Stopping application Dynamic Cache Monitor…
[4/25/11 12:06:57:049 PDT] 00000022 AdminHelper A ADMN1010I: An attempt is made to stop the
Dynamic Cache Monitor application. (User ID =
defaultWIMFileBasedRealm/server:josephNode01Cell_Node01_server1)
[4/25/11 12:06:57:049 PDT] 00000022 CompositionUn A WSVR0192I: Stopping composition unit
WebSphere:cuname=Dynamic Cache Monitor in BLA WebSphere:blaname=Dynamic Cache Monitor.
[4/25/11 12:06:57:049 PDT] 00000022 ApplicationMg A WSVR0217I: Stopping application: Dynamic
Cache Monitor
[4/25/11 12:06:57:081 PDT] 00000022 ApplicationMg A WSVR0220I: Application stopped: Dynamic
Cache Monitor
Joseph’s WebSphere Library
Monitored Deployment/Auto-deployment
7
[4/25/11 12:06:57:752 PDT] 00000022 CompositionUn A WSVR0193I: Composition unit
WebSphere:cuname=Dynamic Cache Monitor in BLA WebSphere:blaname=Dynamic Cache Monitor
stopped.
[4/25/11 12:06:57:752 PDT] 00000022 AppManagement I CWLDD0024I: Event id 1924194575-2.
Application Dynamic Cache Monitor is stopped on: WebSphere:cell=jpaturiwxp03Node01Cell,node=Node01,server=server1,status=success.
[4/25/11 12:06:57:752 PDT] 00000022 AppManagement I CWLDD0017I: Event id 1924194575-2.
Uninstalling application Dynamic Cache Monitor…
[4/25/11 12:07:00:143 PDT] 00000022 AppBinaryProc I ADMA7021I: Distribution of application
Dynamic Cache Monitor completed successfully.
It was successfully uninstalled and again updated and propagated my plugin configuration accordingly.
Final comments:
It is really simple and works well. I liked the plugin configuration update part. Since i‟m working on
Base/Beta version, we have restrictions on the clusters, LB etc.. It would be interesting to see the
deployment on the clusters.
Next Steps:
Try and use the „deploymentProperties‟ file to customize the deployments, updates, undeployments.
Joseph’s WebSphere Library
Monitored Deployment/Auto-deployment
8
References
1. http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/index.jsp?topic=/com.ibm.iea.w
as_v8/was/8.0/Administration/WASv8_MonitoredDirectoryDeploy/player.html
Joseph’s WebSphere Library
Monitored Deployment/Auto-deployment
9
About Author
Joseph Amrith Raj is a technical consultant for multiple WebSphere products. He worked on various
product consulting and support teams including WebSphere Application Server, WebSphere MQ,
WebSphere Message Broker, Enterprise Service Bus and WebSphere Process Server. He has 7 years of
experience in administration, troubleshooting, consulting and he has significant experience in
architecture, strategy and leadership positions. He is IBM certified for WAS, WMQ, WPS , SOA and Cloud
Computing.
Joseph’s WebSphere Library
Monitored Deployment/Auto-deployment
10
Connect With US
 Get notified on upcoming tutorials
 Subscribe, to get this WebSphere blog posts directly to your inbox : here
 Tell us your feedback and what you want
 Please leave your comments in the comments section below the post
 Send us suggestions for future topics and improvements about the content at
webspherelibrary@live.com
 Be Connected!
 Connect with us on Facebook
 Connect with us on Twitter
 More about us : profile
Joseph’s WebSphere Library
Download