06 Apr 2012
April 6, 2012

Deploying using Jython

April 6, 2012 WebSphere, WebSphere Application Server 0 Comment

Some simple concepts that help with using Jython to deploy applications.

When installing an application and you want to know all the options for binding resources and virtual hosts etc in your Jython script, the quickest way to learn is to record a deployment using the console.

In my example I am using WebSphere Application Server 8, but the principle is the same fro WebSphere version 7.

Lets us turn on the ability to record the Jython and deploy a ample application that is used in my training course: WebSphere Application Server 8 Network Deployment Essentials.

Setting up the console to record Jython

  1. Log into the Administrative Console and navigate to the “System Administration” section and click “console Preferences”

  1. Check the “Enable command assistance notifications” check box. If you want to log to <was_profile_root>/logs /<server_name> then check “Log command assistance commands” check box as well.

  1. Click Apply and Save.

We can now see the full code required to deeply an application.

Deploying EShoppe.war

In my course module called the Application Deployment Howto and another module called Administrative scripting Howto, I cover how to automatically deploy a WAR file. We can either deploy a War file or EAR file in WAS. The differences of both are also covered in my course theory PPT slides that come with the full course. The course is available for officially normally $249, but currently $149. It is limited to only 1000 sales world wide for this price, so get in quick as it is selling fast. To buy this course, send me a contact form via http://www.the middlewareshop.com. After July 31st 2012 the source can be purchased online.

Below is a quick, brief example.

  1. Navigate to the “Applications” Section in the administrative console, then expand “Application Types” then click

  1. In the “Enterprise Applications” view click “Install”

  1. Either browse locally or remotely to locate your WAR file

  1. Click Next
  2. Choose fast path
  3. Follow the required to map resources and modules. You can see some of the steps below:

  1. On the summary page you will see the option “View administrative scripting commands for last action”. These are also faiavle in the loga folder in a file called:

  1. Below is an example of the Jython that might be generated. You can use this recoded Jython as a base for your script.

Configuring the build file takes some effort. But WebSphere eases the task to a great extent by providing a feature which allows you to record the changes you make through admin console as wsadmin scripts. This is explained later. For now, when you deploy EShoppe application through admin console and use the recording feature, this is what you get.

***************************************************************************

# [2/25/12 12:53:39:370 IST] Enterprise Applications > Enterprise Applications > Available resources

AdminApp.install(‘EShoppe.war’, ‘[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname EShoppe_war -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -contextroot /eshoppe -MapResRefToEJB [[ EShoppe.war “” EShoppe.war,WEB-INF/web.xml jdbc/eshoppe javax.sql.DataSource jdbc/eshoppe “” “” “” ]] -MapModulesToServers [[ EShoppe.war EShoppe.war,WEB-INF/web.xml WebSphere:cell=appsrv01node01,node=node01,server=server1 ]] -MapWebModToVH [[ EShoppe.war EShoppe.war,WEB-INF/web.xml default_host ]] -CtxRootForWebMod [[ EShoppe.war EShoppe.war,WEB-INF/web.xml /eshoppe ]]]’ )

# [2/25/12 12:53:47:572 IST] Enterprise Applications > Enterprise Applications > Available resources

AdminConfig.save()

***************************************************************************

In my Course I show you how to use this information to write object oriented Jython code that is much better then the code you see on the internet.

Buy Now!
The WebSphere 8 Essentials Course: (Previously $249), now currently $149 for the first 1000 sales.
IBM comparative cost is over $2500 for the same information!
http://www.themidddlewareshop.com
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply