Jython install application websphere
We will create two Jython script files to be called by the wsadmin tool. One script will install (deploy) an application and the other will uninstall it.
1. Create a file called <scripts_home>/jython/uninstallApp.py.
2. Copy in the following code:
#Uninstall the application deployEAR="<deploy_home>/techpasteDemoAPP.ear" appName="techpasteDemoAPP" AdminApp.uninstall(appName); #save AdminConfig.save();
3. Save the uninstallApp.py file.
4. To run the installation, type the following command:
°° For Linux: <was_profile_root>/bin/wsadmin.sh –username wasadmin –password wasadmin -lang jython -f <scripts_home>/jython/uninstallApp.py °° For Windows: <was_profile_root>\bin\wsadmin.bat –username wasadmin –password wasadmin -lang jython -f <scripts_home>\jython\uninstallApp.py
5. The result of the preceding script will be similar to the following:
WASX7209I: Connected to process "server01" on node node01 using SOAP connector; The type of process is: UnManagedProcess ADMA5017I: Uninstallation of techpasteDemoAPP started. ADMA5104I: The server index entry for WebSphere:cell=s15418Node01Cell,node=node01 is updated successfully. ADMA5102I: The configuration data for techpasteDemoAPP from the configuration repository is deleted successfully. ADMA5011I: The cleanup of the temp directory for application techpasteDemoAPP is complete. ADMA5106I: Application techpasteDemoAPP uninstalled successfully.
INSTALL APPLICATION:
6. Create a file called <scripts_home>/jython/installApp.py.
7. Copy in the following code:
#install the application deployEAR="<scripts_home/deploy>/techpasteDemoAPP.ear" appName="techpasteDemoAPP" attr="-appname " + appName + " " AdminApp.install(deployEAR, "["+attr+"]" ); #save AdminConfig.save();
8. Save the installApp.py file.
9. To run the installation, type the following command:
°° For Linux: <was_profile_root>/bin/wsadmin.sh –username wasadmin –password wasadmin -lang jython -f <scripts_home>/jython/installApp.py °° For Windows: <was_profile_root>\bin\wsadmin.bat–username wasadmin –password wasadmin -lang jython -f <scripts_home>\installApp.py
10. The result will be similar to the following screen output:
WASX7209I: Connected to process "server01" on node node01 using SOAP connector; The type of process is: UnManagedProcess ADMA5016I: Installation of techpasteDemoAPP started. ADMA5058I: Application and module versions are validated with versions of deployment targets. ADMA5005I: The application techpasteDemoAPP is configured in the WebSphere Application Server repository. ADMA5053I: The library references for the installed optional package are created. ADMA5005I: The application techpasteDemoAPP is configured in the WebSphere Application Server repository. ADMA5001I: The application binaries are saved in /var/apps/was8/profiles/appsrv01/wstemp/Script18510/workspace/cells/557Node01Cell/applications/techpasteDemoAPP.ear/techpasteDemoAPP.ear ADMA5005I: The application techpasteDemoAPP is configured in the WebSphere Application Server repository. SECJ0400I: Successfully updated the application techpasteDemoAPP with the appContextIDForSecurity information. ADMA5005I: The application techpasteDemoAPP is configured in the WebSphere Application Server repository. ADMA5113I: Activation plan created successfully. ADMA5011I: The cleanup of the temp directory for application techpasteDemoAPP is complete. ADMA5013I: Application techpasteDemoAPP installed successfully.
If you are getting tired of typing –lang Jython to specify that wsadmin should use the Jython language, you can change the wsadmin.properties file in WebSphere to make Jython the default language for scripting. The wsadmin.poperties file is located in the <was_profile_root>/properties/folder. Edit the file and change the com.ibm.ws.scripting. defaultLang=jacl line to com.ibm.ws.scripting.defaultLang=jython and save the changes to ensure that wsadmin uses Jython by default.
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.
Hi,
I want to write a batch script to install an application on Websphere using jacl.
I have got it on cmd using $AdminApp install war_file_path. But want to make a complete batch script. please help me.
Hi Bharti,
Why you want to use JACL it’s deprecated and no-more supported. But if you still want it like that in JACL and batch,
then you can create a small batch like below with install commands in it.
You can use below sample batch script to deploy or install application to Websphere using wsadmin.bat on Windows.
Note: Change the password , username , ear file name and nodename,servernames accordingly.
Batch file (autodeploy.bat)
================================
If you are really interested from more JACL scripts then you can visit below link for more scripts.
http://www.techpaste.com/tag/jacl-scripts/
HTH,
Techpaste.Com