websphere application server v8 primer · pdf file06/04/2012 · deployment using...

12
By Joseph Amrith Raj WebSphere Application Server v8 Primer Chapter 6

Upload: lamthu

Post on 09-Mar-2018

228 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

By Joseph Amrith Raj

WebSphere Application Server v8

Primer

Chapter

6

Page 2: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 2

Joseph’s WebSphere Library

J O S E P H ’ S W E B S P H E R E L I B R A R Y

WebSphere Application Server v8

Primer, part-6: Deployment using

property files and monitored directory

WebSphere Library

http://webspherelibrary.mp http://facebook.com/webspherelibrary

Page 3: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 3

Joseph’s WebSphere Library

Table of Contents Monitored Deployment ................................................................................................................................ 4

Steps involved ............................................................................................................................................... 4

Step1 ................................................................................................................................................. 4

Step2 ................................................................................................................................................. 4

Step3 ................................................................................................................................................. 4

Step4 ................................................................................................................................................. 4

Creating properties files ................................................................................................................................ 5

Extract application properties to a file that uses the old application output format ............................... 5

Extract application properties to a file that uses the simple output format ............................................ 5

Difference in both formats: ...................................................................................................................... 5

Properties Files.......................................................................................................................................... 6

Examples ....................................................................................................................................................... 7

Deploying application on a target ............................................................................................................. 7

Undeploy the application .......................................................................................................................... 8

References .................................................................................................................................................. 10

About Author .............................................................................................................................................. 11

Connect With US ......................................................................................................................................... 12

Page 4: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 4

Joseph’s WebSphere Library

As we discussed earlier in chapter-5, WebSphere Application Server v8 introduced a new feature using

which you can deploy applications [war/ear/sar/jar] by placing them in a directory which will be

monitored by WebSphere Application Server and you can customize the polling interval.

In this chapter, I am going to show, how to install a application in a distributed environment using the

property files. WebSphere scans the monitored directory for every 5 secs [default polling interval] for

new properties file. If it finds a new properties file, websphere automatically runs applyconfigProperties

wsadmin command and install the application or module on the application server and start the

app/module. You can also use the properties files to update or undeploy the applications or modules.

Monitored Deployment 1. Before trying these steps, please make sure that you’ve the monitored directory enabled by

checking in the admin console at applications Global deployment Settings. If you need to

enable the monitored deployment, please follow the instruction provided in this post.

2. Before proceeding with the deployment, you should ensure that the target application server is

running.

Steps involved The procedure to do deployment using properties files and monitored directory

Step1: Monitored directory should be enabled

Step2: Target application server should be running

Step3: Create properties file

Step4: Copy the properties file to monitored directories.

Upon a successful deployment, you can find a directory with the same name as that of the file to the

installedApps/Cell_name. You can also verify the log for a messages starts with CWLDD.

Page 5: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 5

Joseph’s WebSphere Library

Creating properties files You can use an edited properties file to install or update an application. To extract the properties file of

a deployed enterprise application to edit or use as a template, run the extractConfigProperties

command. extractConfigProperties, this command can generate the output in either old application

output format or simple output format.

Extract application properties to a file that uses the old application output

format AdminTask.extractConfigProperties('[-propertiesFileName DefaultApp.props -

configData Deployment=DefaultApp]')

The above jython command generates DefaultApp.props file that can contains properties of an

application named DefaultApp.

Extract application properties to a file that uses the simple output format AdminTask.extractConfigProperties('[-propertiesFileName DefaultApp.props -

configData Deployment=DefaultApp -options [[SimpleOutputFormat true]]]')

The above jython command generates DefaultApp.props file that contains properties of an application

named DefaultApp in Simple output format.

Difference in both formats:

In old application output format, output displays all columns, including hidden and non-hidden

columns, of install task and task data values in separate rows. The mutables row shows which

columns you can edit (true) and which you cannot edit (false)

In simple output format, the output displays non-hidden columns of application properties in

columnName=value pairs. Hidden columns of application properties are not included in the

output.

Below is a screenshot that shows the difference in the output of the simple Output format and

old application output format.

Page 6: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 6

Joseph’s WebSphere Library

Properties Files The properties files that you use in monitored directories are like the Application Properties files that

you use for install, update, delete etc... But properties files used for monitored directories differ slightly:

You do not need to specify statements such as

CreateDeleteCommandProperties=true in the header.

To uninstall an enterprise application, you specify DELETE=true in the header of the

properties section.

Only specify application resource type operations, ImplementingResourceType=Application,

in the properties file. If the properties file contains a non-application resource type such as

ImplementingResourceType=Server, the product will return an error message and not perform

the operation on the resource type.

Page 7: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 7

Joseph’s WebSphere Library

Examples

Deploying application on a target Use below properties file template to do a simple installation of an application on a deployment target.

You must provide Name of the application [Name], TargetServer, TargetNode and EarFileLocation.

Here is my Cell configuration

I like to install CacheMonitor.ear to server1. So I prepared the following properties file.

# Header # ResourceType=Application ImplementingResourceType=Application # Properties Name=!{applicationName} TargetServer=!{serverName} TargetNode=!{nodeName} EarFileLocation=C:\IBM\WebSphere8ND\installableApps\CacheMonitor.ear EnvironmentVariablesSection #

Page 8: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 8

Joseph’s WebSphere Library

# Environment Variables # applicationName=CacheMonitor cellName=joseph nodeName=AppNode01 serverName=server1

Now move the properties file to monitored directory/deploymentProperties directory.

After 5 seconds check the log file.

Note: As I’m using HPEL [3] without text log, I checked the log from admin console. If you are not using

HPEL, check your SystemOut.log

Undeploy the application Use the following template

# # Header

Page 9: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 9

Joseph’s WebSphere Library

# ResourceType=Application ImplementingResourceType=Application DELETE=true # Properties Name=CacheMon

Page 10: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 10

Joseph’s WebSphere Library

References 1. http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/index.jsp?topic=/com.ibm.iea.was_

v8/was/8.0/Administration/WASv8_AppDeploy/player.html

2. More examples and templates can be found on IBM Infocenter, HERE

Page 11: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 11

Joseph’s WebSphere Library

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.

Page 12: WebSphere Application Server v8 Primer · PDF file06/04/2012 · Deployment using property files and monitored directory 4 Joseph’s WebSphere Library As we discussed earlier in chapter-5,

Deployment using property files and monitored directory 12

Joseph’s WebSphere Library

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

[email protected]

Be Connected!

Connect with us on Facebook

Connect with us on Twitter

More about us : profile