Wednesday, September 30, 2015

Latest Jython using in Thin Client WebSphere 8.5 on Vagrant Ubuntu box

How to use the latest Jython for wsadmin

Today my experiment on renovating wsadmin Jython version.

How to check the current Jython version?


It is very simple you can try with sys module attribute version and one more thing your jdk that used for wsadmin runs on which version you can know by sys.platform.
wsadmin>print sys.version
2.1
wsadmin>print sys.platform
java1.6.0


  1. Installing Jython in Thin Client Home

  2. Executing the Jython jar command in the ThinClt/lib directory :
    vagrant@ubuntu-was8:~/ThinClt/lib$ java -jar /vagrant/was8_5_install/jython-installer-2.7.0.jar
    Welcome to Jython !
    You are about to install Jython version 2.7.0
    (at any time, answer c to cancel the installation)
    For the installation process, the following languages are available: English, German
    Please select your language [E/g] >>> E
    Do you want to read the license agreement now ? [y/N] >>> N
    Do you accept the license agreement ? [Y/n] >>> Y
    The following installation types are available:
      1. All (everything, including sources)
      2. Standard (core, library modules, demos and examples, documentation)
      3. Minimum (core)
      9. Standalone (a single, executable .jar)
    Please select the installation type [ 1 /2/3/9] >>> 2
    Do you want to install additional parts ? [y/N] >>> y
    The following parts are selectable (n = no more) [mod/demo/doc/src/ensurepip/N] >>> N
    N scheduled for installation
    The following parts are selectable (n = no more) [mod/demo/doc/src/ensurepip/N] >>> n
    Do you want to exclude parts from the installation ? [y/N] >>> y
    The following parts are selectable (n = no more) [mod/demo/doc/src/ensurepip/N] >>>
    Please enter the target directory >>> /home/vagrant/ThinClt/lib/jython
    Unable to find directory /home/vagrant/ThinClt/lib/jython, create it ? [Y/n] >>> Y
    Your java version to start Jython is: Oracle Corporation / 1.7.0_79
    Your operating system version is: Linux / 3.19.0-25-generic
    Summary:
      - mod: true
      - demo: true
      - doc: true
      - src: false
      - ensurepip: true
      - JRE: /usr/lib/jvm/java-7-openjdk-amd64/jre
    Please confirm copying of files to directory /home/vagrant/ThinClt/lib/jython [Y/n] >>> Y
     10 %
     20 %
     30 %
     40 %
     50 %
     60 %
     70 %
    Generating start scripts ...
    Installing pip and setuptools
     90 %
    Ignoring indexes: https://pypi.python.org/simple/
    Downloading/unpacking setuptools
    Downloading/unpacking pip
    Installing collected packages: setuptools, pip
    Successfully installed setuptools pip
    Cleaning up...
     100 %
    Do you want to show the contents of README ? [y/N] >>> N
    Congratulations! You successfully installed Jython 2.7.0 to directory /home/vagrant/ThinClt/lib/jython.
  3. Copy Java from IBM WebSphere installed path
    cp -R $WAS_HOME/java ThinClt/
    
  4. copy com.ibm.ws.security.crypto.jar from WAS_HOME/plugins
  5. Create properties folder in the ThinClt directory and copy the properties from
      cd $PROFILE_HOME/properties
      cp ipc.client.props ~/ThinClt/properties/
      cp soap.client.props ~/ThinClt/properties/
      cp sas.client.props ~/ThinClt/properties/
      cp ssl.client.props ~/ThinClt/properties/
      cp wsjaas_client.conf ~/ThinClt/properties/
    
    • ipc.client.props: supports IPC connections.
    • soap.client.props: supports SOAP connections modify com.ibm.SOAP.securityEnabled to true existing value :
      com.ibm.SOAP.securityEnabled=false
      changed to :
      com.ibm.SOAP.securityEnabled=true
    • sas.client.props: supports JSR160RMI connections (preferred)
    • ssl.client.props: supports encrypted connections and modify user.root value
      user.root=/home/vagrant/ThinClt
      
    • wsjaas_client.conf: supports secured connections.
    cp -R ../properties/messages/ ~/ThinClt/properties/
    
    vagrant@ubuntu-was8:~/ThinClt/properties$ ls -lrt
    total 52
    drwxr-xr-x 18 vagrant vagrant  4096 Sep 30 14:54 messages
    -rwxr-xr-x  1 vagrant vagrant  5442 Sep 30 14:56 ipc.client.props
    -rwxr-xr-x  1 vagrant vagrant  5370 Sep 30 14:57 soap.client.props
    -rwxr-xr-x  1 vagrant vagrant 12114 Sep 30 14:57 sas.client.props
    -rwxr-xr-x  1 vagrant vagrant  5025 Sep 30 15:00 ssl.client.props
    -rwxr-xr-x  1 vagrant vagrant  3789 Sep 30 15:01 wsjaas_client.conf
    -rwxrwxr-x  1 vagrant vagrant  8046 Sep 30 16:39 wsadmin.properties
    
    
  6. Create logs directory in ThinClt
  7. Create profiles directory in ThinClt here you need to copy ThinClientProfile.py script.
    vagrant@ubuntu-was8:~/ThinClt$ mkdir profile
    vagrant@ubuntu-was8:~/ThinClt$ cp /vagrant/was8_5_install/ThinClientProfile.py profile/
    
    
  8. Copy scriptLibraries to ThinClt directory rename it to wasScriptLibraries
    vagrant@ubuntu-was8:~/ThinClt$ mv scriptLibraries wasScriptLibraries
    
    Make sure all the class files are deleted so they get recompiled with the new Jython. From the directory:
    find ./wasScriptLibraries –name “*.class” | xargs rm
    
  9. Copy thinClient.sh from the IBM download link then extract copy to ThinClt directory. Modify /opt to /home/vagrant  in vi editor : %s/opt/home\/vagrant/g
  10. Create a directory named etc in ~/ThinClt here the thin client key and trust store files will be created for use with encrypted connections to remote deployment managers.
    cd $PROFILE_HOME/etc/
    cp *p12 ~/ThinClt/etc
    
Use your brain when you failed to do the commands almost simplified more than IBM article!! :)

Monday, September 28, 2015

Setup WebSphere 8.5 on Ubuntu Vagrant box

I've started working on new adventure being in the WebLogic wold had some basic knowledge on Virtuallization with Vagrant and Oracle VirtualBox begin my experiment for WebSphere installation on Ubuntu box.

Prerequisites

  1. Download and install Vagrant for Windows
  2. Download and install Oracle VirtualBox
  3. Download Installation Manager

Lets Start Virtualization for WebSphere 8.5 with Vagrant


Initially I started following the steps which are given Pattrick Hueper in the Vagrant Ubuntu WebSphere 8.5. Downloaded the Vagrantfiles folder using git command.

git clone https://github.com/phueper/vagrantfiles.git

Then followed the read me document in that.

Modify the Vagrantfile

It stuck saying Ubuntu box is not available so I have changed the Vagrant file  with the following line:

    config.vm.box = "bento/ubuntu-14.04"
and I faced issue with the private network then I modified that with the following line:

    config.vm.network "private_network", ip: "192.168.33.113"

As suggested in that same github README.md dowloaded the InstallationManager from the IBM site.

copied the IMAgent file to /vagrant/was8_5_install

F:\was-work\vagrantfiles\ubuntu_websphere8_5>vagrant up [ skipping this output ]


F:\was-work\vagrantfiles\ubuntu_websphere8_5>vagrant provision
==> default: Running provisioner: shell...
    default: Running: C:/Users/Raghav/AppData/Local/Temp/vagrant-shell20150928-2572-1v2st7d.sh
==> default: stdin: is not a tty
==> default: Running Ansible provisioner defined in Vagrantfile.
==> default:
==> default: PLAY [playbook for system setup] **********************************************
==> default:
==> default: GATHERING FACTS ***************************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE setup
==> default: ok: [default]
==> default:
==> default: TASK: [apt update_cache=yes upgrade=dist] *************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE apt update_cache=yes upgrade=dist
==> default: ok: [default] => {"changed": false, "msg": "Reading package lists...\nBuilding dependency tree...\nReading state information...\n0 u
pgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n", "stderr": "", "stdout": "Reading package lists...\nBuilding dependency tree...\nR
eading state information...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n"}
==> default:
==> default: TASK: [apt name=byobu state=latest] *******************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE apt name=byobu state=latest
==> default: ok: [default] => {"changed": false}
==> default:
==> default: TASK: [apt name=git] **********************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE apt name=git
==> default: ok: [default] => {"changed": false}
==> default:
==> default: TASK: [apt name=openjdk-7-jdk] ************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE apt name=openjdk-7-jdk
==> default: ok: [default] => {"changed": false}
==> default:
==> default: TASK: [disable stupid dash] ***************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command debconf-set-selections /vagrant/was8_5_install/dash_debconf
==> default: changed: [default] => {"changed": true, "cmd": ["debconf-set-selections", "/vagrant/was8_5_install/dash_debconf"], "delta": "0:00:00
.138656", "end": "2015-09-28 11:36:05.939550", "rc": 0, "start": "2015-09-28 11:36:05.800894", "stderr": "", "stdout": ""}
==> default:
==> default: TASK: [reconfigure stupid dash] ***********************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command dpkg-reconfigure -f noninteractive dash
==> default: changed: [default] => {"changed": true, "cmd": ["dpkg-reconfigure", "-f", "noninteractive", "dash"], "delta": "0:00:00.224939", "end
": "2015-09-28 11:36:06.225866", "rc": 0, "start": "2015-09-28 11:36:06.000927", "stderr": "", "stdout": ""}
==> default:
==> default: PLAY [playbook for swap file setup] *******************************************
==> default:
==> default: GATHERING FACTS ***************************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE setup
==> default: ok: [default]
==> default:
==> default: TASK: [Create swap file] ******************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command dd if=/dev/zero of=/swapfile bs=1024 count=2048k creates="/swapfile"
==> default: skipping: [default]
==> default:
==> default: TASK: [Change swap file permissions] ******************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE file path="/swapfile" owner=root group=root mode=0600
==> default: ok: [default] => {"changed": false, "gid": 0, "group": "root", "mode": "0600", "owner": "root", "path": "/swapfile", "size": 2147483
648, "state": "file", "uid": 0}
==> default:
==> default: TASK: [Check swap file type] **************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command file /swapfile
==> default: changed: [default] => {"changed": true, "cmd": ["file", "/swapfile"], "delta": "0:00:00.002126", "end": "2015-09-28 11:36:06.613414"
, "rc": 0, "start": "2015-09-28 11:36:06.611288", "stderr": "", "stdout": "/swapfile: Linux/i386 swap file (new style), version 1 (4K pages), siz
e 524287 pages, no label, UUID=9d64efa0-eef3-43b2-829f-af768cd6b678"}
==> default:
==> default: TASK: [Make swap file] ********************************************************
==> default: skipping: [default]
==> default:
==> default: TASK: [Write swap entry in fstab] *********************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE mount name=none src=/swapfile fstype=swap opts=sw passno=0 dump=0 state=present
==> default: ok: [default] => {"changed": false, "dump": "0", "fstab": "/etc/fstab", "fstype": "swap", "name": "none", "opts": "sw", "passno": "0
", "src": "/swapfile"}
==> default:
==> default: TASK: [Mount swap] ************************************************************
==> default: skipping: [default]
==> default:
==> default: TASK: [Minimise swapiness (only on out of memory)] ****************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE sysctl value=0 name=vm.swappiness
==> default: ok: [default] => {"changed": false}
==> default:
==> default: PLAY [playbook for vagrant user] **********************************************
==> default:
==> default: GATHERING FACTS ****
==> default: ***********************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE setup
==> default: ok: [default]
==> default:
==> default: TASK: [use ctrl-a screen mode] ************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command byobu-ctrl-a screen
==> default: changed: [default] => {"changed": true, "cmd": ["byobu-ctrl-a", "screen"], "delta": "0:00:00.011868", "end": "2015-09-28 11:36:07.02
5121", "rc": 0, "start": "2015-09-28 11:36:07.013253", "stderr": "failed to connect to server\nfailed to connect to server", "stdout": "INFO: ctr
l-a will now operate in GNU Screen mode\nTo modify this behavior again later, run 'byobu-ctrl-a'"}
==> default:
==> default: TASK: [enable byobu on login] *************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command byobu-launcher-install
==> default: changed: [default] => {"changed": true, "cmd": ["byobu-launcher-install"], "delta": "0:00:00.023743", "end": "2015-09-28 11:36:07.09
0566", "rc": 0, "start": "2015-09-28 11:36:07.066823", "stderr": "", "stdout": ""}
==> default:
==> default: TASK: [enable byobu prompt] ***************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command byobu-enable-prompt
==> default: changed: [default] => {"changed": true, "cmd": ["byobu-enable-prompt"], "delta": "0:00:00.012451", "end": "2015-09-28 11:36:07.14459
2", "rc": 0, "start": "2015-09-28 11:36:07.132141", "stderr": "", "stdout": "\nYou will need to reload your shell configuration for this to take
effect...\n  . ~/.bashrc"}
==> default:
==> default: PLAY [playbook for WAS 8.5 Setup] *********************************************
==> default:
==> default: GATHERING FACTS ***************************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE setup
==> default: ok: [default]
==> default:
==> default: TASK: [unzip IM 1.8.3] ********************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command mkdir -p /vagrant/tmp/im_1.8.3; cd /vagrant/tmp/im_1.8.3; unzip /vagrant/was8_5_install/agent.inst
aller.linux.gtk.x86_64_1.8.3000.20150606_0047.zip creates=/vagrant/tmp/im_1.8.3/userinstc #USE_SHELL
==> default: skipping: [default]
==> default:
==> default: TASK: [install IM 1.8.3] ******************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command ./userinstc -s -sP -acceptLicense -input /vagrant/was8_5_install/userinstc.installationmanager_1.8
.record chdir=/vagrant/tmp/im_1.8.3 creates=/home/vagrant/IBM/InstallationManager/eclipse/IBMIM #USE_SHELL
==> default: skipping: [default]
==> default:
==> default: TASK: [register user for WAS 8.5 repository] **********************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command . /vagrant/was8_5_install/ibm_user.sh; tools/imutilsc saveCredential -userName ${IBM_USER} -userPa
ssword ${IBM_PWD} -url http://www.ibm.com/software/repositorymanager/V85WASDeveloperILANL/repository.config chdir=/home/vagrant/IBM/InstallationM
anager/eclipse creates=/home/vagrant/IBM/WebSphere/AppServer/bin/manageprofiles.sh #USE_SHELL
==> default: changed: [default] => {"changed": true, "cmd": ". /vagrant/was8_5_install/ibm_user.sh; tools/imutilsc saveCredential -userName ${IBM
_USER} -userPassword ${IBM_PWD} -url http://www.ibm.com/software/repositorymanager/V85WASDeveloperILANL/repository.config", "delta": "0:00:08.582
384", "end": "2015-09-28 11:36:16.122411", "rc": 0, "start": "2015-09-28 11:36:07.540027", "stderr": "", "stdout": "Successfully saved the creden
tial to the secure storage file."}
==> default:
==> default: TASK: [install WAS 8.5] *******************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command ./IBMIM -s -sP -acceptLicense -input /vagrant/was8_5_install/IBMIM.install_was85.record chdir=/hom
e/vagrant/IBM/InstallationManager/eclipse creates=/home/vagrant/IBM/WebSphere/AppServer/bin/manageprofiles.sh #USE_SHELL
==> default: changed: [default] => {"changed": true, "cmd": "./IBMIM -s -sP -acceptLicense -input /vagrant/was8_5_install/IBMIM.install_was85.rec
ord", "delta": "0:44:36.049535", "end": "2015-09-28 12:20:52.215826", "rc": 0, "start": "2015-09-28 11:36:16.166291", "stderr": "", "stdout": "
               25%                50%                75%                100%\n------------------|------------------|------------------|----------
--------|\n............................................................................\nInstalled com.ibm.websphere.IHSILAN.v85_8
==> default: .5.5006.20150529_0536 to the /home/vagrant/IBM/HTTPServer directory.\nInstalled com.ibm.websphere.DEVELOPERSILAN.v85_8.5.5006.201505
29_0536 to the /home/vagrant/IBM/WebSphere/AppServer directory.\nInstalled com.ibm.websphere.IBMJAVA.v70_7.0.9000.20150528_2007 to the /home/vagr
ant/IBM/WebSphere/AppServer directory.\nInstalled com.ibm.websphere.PLGILAN.v85_8.5.5006.20150529_0536 to the /home/vagrant/IBM/WebSphere/Plugins
 directory.\nInstalled com.ibm.websphere.WCTILAN.v85_8.5.5006.20150529_0536 to the /home/vagrant/IBM/WebSphere/Toolbox directory.\nCRIMA1002W WAR
NING: The following repositories are not connected:\n-/vagrant/tmp/im_1.8.3\n\n\nExplanation: Failed to connect to one or more repositories. The
repository might be unavailable for several reasons.\n\nUser Action: Check the following items:\nVerify the repository location is correct.\nFor
repositories that require credentials, verify that the credentials are correct. Credentials can be set in the Repositories preference.\nVerify th
e network connection is available. \nFor environments that use proxies, verify the proxy settings are correct. Proxy settings can be set in the H
TTP/FTP preference.\nUpdate offerings require that base offerings be available. Verify the base offering is available in a repository. Use the li
stAvailablePackages command to view the packages available in a repository.\nIf you are using the IBM Passport Advantage site, verify the connect
ion to the site is correct. Verify the Passport Advantage connection in the Passport Advantage preference.\nFor environments that use firewalls,
verify that access to the repository location is available.\nWARNING: /vagrant/tmp/im_1.8.3 is not a repository. It is an install package for Ins
tallation Manager version 1.8.3 (internal version 1.8.3000.20150606_0047). Installation Manager version 1.8.3 (internal version 1.8.3000.20150606
_0047) is already installed."}
==> default:
==> default: PLAY [playbook for profile creation in WAS 8.5] *******************************
==> default:
==> default: GATHERING FACTS ***************************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE setup
==> default: ok: [default]
==> default:
==> default: TASK: [create profile] ********************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command ./IBM/WebSphere/AppServer/bin/manageprofiles.sh -create -templatePath /home/vagrant/IBM/WebSphere/
AppServer/profileTemplates/default/ -profileName rplan-profile -profilePath /home/vagrant/IBM/WebSphere/AppServer/profiles/rplan-profile/ -applyP
erfTuningSetting development chdir=/home/vagrant creates=/home/vagrant/IBM/WebSphere/AppServer/profiles/rplan-profile/ #USE_SHELL
==> default: changed: [default] => {"changed": true, "cmd": "./IBM/WebSphere/AppServer/bin/manageprofiles.sh -create -templatePath /home/vagrant/
IBM/WebSphere/AppServer/profileTemplates/default/ -profileName rplan-profile -profilePath /home/vagrant/IBM/WebSphere/AppServer/profiles/rplan-pr
ofile/ -applyPerfTuningSetting development", "delta": "0:01:04.080609", "end": "2015-09-28 12:21:57.046736", "rc": 0, "start": "2015-09-28 12:20:
52.966127", "stderr": "", "stdout": "INSTCONFSUCCESS: Success: Profile rplan-profile now exists. Please consult /home/vagrant/IBM/WebSphere/AppSe
rver/profiles/rplan-profile/logs/AboutThisProfile.txt for more information about this profile."}
==> default:
==> default: TASK: [increase admin console timeout] ****************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE replace dest=/home/vagrant/IBM/WebSphere/AppServer/profiles/rplan-profile/config/cells/ubuntu-was8Node01Ce
ll/applications/isclite.ear/deployments/isclite/deployment.xml regexp='(invalidationTimeout=)"30"' replace='\1"1440"' backup=yes
==> default: changed: [default] => {"changed": true, "msg": "1 replacements made"}
==> default:
==> default: TASK: [start WAS] *************************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command ./IBM/WebSphere/AppServer/profiles/rplan-profile/bin/startServer.sh server1 chdir=/home/vagrant #U
SE_SHELL
==> default: changed: [default] => {"changed": true, "cmd": "./IBM/WebSphere/AppServer/profiles/rplan-profile/bin/startServer.sh server1", "delta
": "0:00:47.676365", "end": "2015-09-28 12:22:44.896126", "rc"
==> default: : 0, "start": "2015-09-28 12:21:57.219761", "stderr": "", "stdout": "ADMU0116I: Tool information is being logged in file\n
 /home/vagrant/IBM/WebSphere/AppServer/profiles/rplan-profile/logs/server1/startServer.log\nADMU0128I: Starting tool with the rplan-profile profi
le\nADMU3100I: Reading configuration for server: server1\nADMU3200I: Server launched. Waiting for initialization status.\nADMU3000I: Server serve
r1 open for e-business; process id is 6632"}
==> default:
==> default: TASK: [create webserver config] ***********************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command ./IBM/WebSphere/AppServer/bin/wsadmin.sh -f IBM/WebSphere/AppServer/bin/configureWebserverDefiniti
on.jacl webserver1 IHS /home/vagrant/IBM/HTTPServer /home/vagrant/IBM/HTTPServer/conf/httpd.conf 8080 MAP_ALL /home/vagrant/IBM/WebSphere/Plugins
 unmanaged ubuntu-was8Node01 ubuntu-was8 linux 8008 admin admin webserver1 chdir=/home/vagrant #USE_SHELL
==> default: changed: [default] => {"changed": true, "cmd": "./IBM/WebSphere/AppServer/bin/wsadmin.sh -f IBM/WebSphere/AppServer/bin/configureWeb
serverDefinition.jacl webserver1 IHS /home/vagrant/IBM/HTTPServer /home/vagrant/IBM/HTTPServer/conf/httpd.conf 8080 MAP_ALL /home/vagrant/IBM/Web
Sphere/Plugins unmanaged ubuntu-was8Node01 ubuntu-was8 linux 8008 admin admin webserver1", "delta": "0:00:23.155538", "end": "2015-09-28 12:23:08
.131752", "rc": 0, "start": "2015-09-28 12:22:44.976214", "stderr": "", "stdout": "WASX7209I: Connected to process \"server1\" on node ubuntu-was
8Node01 using SOAP connector;  The type of process is: UnManagedProcess\nWASX7303I: The following options are passed to the scripting environment
 and are available as arguments that are stored in the argv variable: \"[webserver1, IHS, /home/vagrant/IBM/HTTPServer, /home/vagrant/IBM/HTTPSer
ver/conf/httpd.conf, 8080, MAP_ALL, /home/vagrant/IBM/WebSphere/Plugins, unmanaged, ubuntu-was8Node01, ubuntu-was8, linux, 8008, admin, admin, we
bserver1]\"\n \nInput parameters: \n \n   Web server name             - webserver1 \n   Web server type             - IHS \n   Web server install
 location - /home/vagrant/IBM/HTTPServer \n   Web server config location  - /home/vagrant/IBM/HTTPServer/conf/httpd.conf \n   Web server port
         - 8080 \n   Map Applications            - MAP_ALL \n   Plugin install location     - /home/vagrant/IBM/WebSphere/Plugins \n   Web server
 node type        - unmanaged \n   Web server node name        - ubuntu-was8Node01 \n   Web server host name        - ubuntu-was8 \n   Web server
 operating system - linux \n   IHS Admin port              - 8008 \n   IHS Admin user ID           - admin \n   IHS Admin password          - adm
in \n   IHS service name            - webserver1 \n  \nFound node with matching hostname. Using existing node ubuntu-was8Node01 \n \nNode definit
ion ubuntu-was8Node01 already exists.\n \nCreating the web server definition for webserver1 on node ubuntu-was8Node01.\nParameters for administer
ing IHS web server can also be updated using wsadmin script or admin console.\nWeb server definition for webserver1 is created.\n \nStart computi
ng the plugin properties ID.\nPlugin properties ID is computed.\n \nStart updating the plugin install location.\nPlugin install location is updat
ed.\n \nStart updating the plugin log file location.\nPlugin log file location is updated.\n \nStart updating the RemoteConfigFilename location.\
nPlugin remote config file location is updated.\n \nStart updating the RemoteKeyRingFileName location.\nPlugin remote keyring file location is up
dated.\n \nStart saving the configuration.\n \nConfiguration save is complete.\n \nComputed the list of installed applications.\n \nProcessing th
e application DefaultApplication.\nGet the current target mapping for the application DefaultApplication.\nComputed the current target mapping fo
r the application DefaultApplication.\nStart updating the target mappings for the application DefaultApplication.\nADMA5075I: Editing of applicat
ion DefaultApplication started.\nADMA5058I: Application and module versions are validated with versions of deployment targets.\nADMA
==> default: 5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.\nADMA5005I: The application
DefaultApplication is configured in the WebSphere Application Server repository.\nADMA5005I: The application DefaultApplication is configured in
the WebSphere Application Server repository.\nADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server rep
ository.\nADMA5113I: Activation plan created successfully.\nADMA5011I: The cleanup of the temp directory for application DefaultApplication is co
mplete.\nADMA5076I: Application DefaultApplication edited successfully. The application or its web modules may require a restart when a save is p
erformed.\nTarget mapping is updated for the application DefaultApplication.\n \nProcessing the application ivtApp.\nGet the current target mappi
ng for the application ivtApp.\nComputed the current target mapping for the application ivtApp.\nStart updating the target mappings for the appli
cation ivtApp.\nADMA5075I: Editing of application ivtApp started.\nADMA5058I: Application and module versions are validated with versions of depl
oyment targets.\nADMA5005I: The application ivtApp is configured in the WebSphere Application Server repository.\nADMA5005I: The application ivtA
pp is configured in the WebSphere Application Server repository.\nADMA5005I: The application ivtApp is configured in the WebSphere Application Se
rver repository.\nADMA5005I: The application ivtApp is configured in the WebSphere Application Server repository.\nADMA5113I: Activation plan cre
ated successfully.\nADMA5011I: The cleanup of the temp directory for application ivtApp is complete.\nADMA5076I: Application ivtApp edited succes
sfully. The application or its web modules may require a restart when a save is performed.\nTarget mapping is updated for the application ivtApp.
\n \nProcessing the application query.\nGet the current target mapping for the application query.\nComputed the current target mapping for the ap
plication query.\nStart updating the target mappings for the application query.\nADMA5075I: Editing of application query started.\nADMA5058I: App
lication and module versions are validated with versions of deployment targets.\nADMA5005I: The application query is configured in the WebSphere
Application Server repository.\nADMA5005I: The application query is configured in the WebSphere Application Server repository.\nADMA5005I: The ap
plication query is configured in the WebSphere Application Server repository.\nADMA5005I: The application query is configured in the WebSphere Ap
plication Server repository.\nADMA5113I: Activation plan created successfully.\nADMA5011I: The cleanup of the temp directory for application quer
y is complete.\nADMA5076I: Application query edited successfully. The application or its web modules may require a restart when a save is perform
ed.\nTarget mapping is updated for the application query.\n \nStart saving the configuration.\n \nConfiguration save is complete."}
==> default:
==> default: TASK: [load was module in IHS Config] *****************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE lineinfile dest=/home/vagrant/IBM/HTTPServer/conf/httpd.conf line="LoadModule was_ap22_module /home/vagran
t/IBM/WebSphere/Plugins/bin/64bits/mod_was_ap22_http.so"
==> default: changed: [default] => {"backup": "", "changed": true, "msg": "line added"}
==> default:
==> default: TASK: [load plugin cfg in IHS Config] *****************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE lineinfile dest=/home/vagrant/IBM/HTTPServer/conf/httpd.conf line="WebSpherePluginConfig /home/vagrant/IBM
/WebSphere/Plugins/config/webserver1/plugin-cfg.xml"
==> default: changed: [default] => {"backup": "", "changed": true, "msg": "line added"}
==> default:
==> default: TASK: [start IHS] *************************************************************
==> default: <127 data-blogger-escaped-.0.0.1=""> REMOTE_MODULE command ./IBM/HTTPServer/bin/apachectl start chdir=/home/vagrant #USE_SHELL
==> default: changed: [default] => {"changed": true, "cmd": "./IBM/HTTPServer/bin/apachectl start", "delta": "0:00:00.505888", "end": "2015-09-28
 12:23:09.080952", "rc": 0, "start": "2015-09-28 12:23:08.575064", "stder
==> default: r": "", "stdout": ""}
==> default:
==> default: PLAY RECAP ********************************************************************
==> default: default                    : ok=27   changed=15   unreachable=0    failed=0

F:\was-work\vagrantfiles\ubuntu_websphere8_5>

I've modified the root access and assigned IBM folder to vagrant user following:

vagrant@ubuntu-was8:~$ sudo chown -R vagrant:vagrant IBM

To launch the server

vagrant@ubuntu-was8:~$ IBM/WebSphere/AppServer/profiles/rplan-profile/bin/startServer.sh server1
ADMU0116I: Tool information is being logged in file
           /home/vagrant/IBM/WebSphere/AppServer/profiles/rplan-profile/logs/server1/startServer.log
ADMU0128I: Starting tool with the rplan-profile profile
ADMU3100I: Reading configuration for server: server1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server server1 open for e-business; process id is 1530

And then start the webserver1 as follows:
vagrant@ubuntu-was8:~$ ./IBM/WebSphere/AppServer/bin/wsadmin.sh -f IBM/WebSphere/AppServer/bin/configureWebserverDefinition.jacl  webserver1 IHS /home/vagrant/IBM/HTTPServer /home/vagrant/IBM/HTTPServer/conf/httpd.conf 8080 MAP_ALL /home/vagrant/IBM/WebSphere/Plugins unmanaged ubuntu-was8Node01 ubuntu-was8 linux 8008 admin admin webserver1
WASX7209I: Connected to process "server1" on node ubuntu-was8Node01 using SOAP connector;  The type of process is: UnManagedProcess
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[webserver1, IHS, /home/vagrant/IBM/HTTPServer, /home/vagrant/IBM/HTTPServer/conf/httpd.conf, 8080, MAP_ALL, /home/vagrant/IBM/WebSphere/Plugins, unmanaged, ubuntu-was8Node01, ubuntu-was8, linux, 8008, admin, admin, webserver1]"

Input parameters:

   Web server name             - webserver1
   Web server type             - IHS
   Web server install location - /home/vagrant/IBM/HTTPServer
   Web server config location  - /home/vagrant/IBM/HTTPServer/conf/httpd.conf
   Web server port             - 8080
   Map Applications            - MAP_ALL
   Plugin install location     - /home/vagrant/IBM/WebSphere/Plugins
   Web server node type        - unmanaged
   Web server node name        - ubuntu-was8Node01
   Web server host name        - ubuntu-was8
   Web server operating system - linux
   IHS Admin port              - 8008
   IHS Admin user ID           - admin
   IHS Admin password          - admin
   IHS service name            - webserver1

Found node with matching hostname. Using existing node ubuntu-was8Node01

Node definition ubuntu-was8Node01 already exists.

Web server definition for webserver1 already exists.

Start computing the plugin properties ID.
Plugin properties ID is computed.

Start updating the plugin install location.
Plugin install location is updated.

Start updating the plugin log file location.
Plugin log file location is updated.

Start updating the RemoteConfigFilename location.
Plugin remote config file location is updated.

Start updating the RemoteKeyRingFileName location.
Plugin remote keyring file location is updated.

Start saving the configuration.

Configuration save is complete.

Computed the list of installed applications.

Processing the application DefaultApplication.
Get the current target mapping for the application DefaultApplication.
Computed the current target mapping for the application DefaultApplication.
Start updating the target mappings for the application DefaultApplication.
ADMA5075I: Editing of application DefaultApplication started.
ADMA5058I: Application and module versions are validated with versions of deployment targets.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5005I: The application DefaultApplication is configured in the WebSphere Application Server repository.
ADMA5113I: Activation plan created successfully.
ADMA5011I: The cleanup of the temp directory for application DefaultApplication is complete.
ADMA5076I: Application DefaultApplication edited successfully. The application or its web modules may require a restart when a save is performed.
Target mapping is updated for the application DefaultApplication.

Processing the application ivtApp.
Get the current target mapping for the application ivtApp.
Computed the current target mapping for the application ivtApp.
Start updating the target mappings for the application ivtApp.
ADMA5075I: Editing of application ivtApp started.
ADMA5058I: Application and module versions are validated with versions of deployment targets.
ADMA5005I: The application ivtApp is configured in the WebSphere Application Server repository.
ADMA5005I: The application ivtApp is configured in the WebSphere Application Server repository.
ADMA5005I: The application ivtApp is configured in the WebSphere Application Server repository.
ADMA5005I: The application ivtApp is configured in the WebSphere Application Server repository.
ADMA5113I: Activation plan created successfully.
ADMA5011I: The cleanup of the temp directory for application ivtApp is complete.
ADMA5076I: Application ivtApp edited successfully. The application or its web modules may require a restart when a save is performed.
Target mapping is updated for the application ivtApp.

Processing the application query.
Get the current target mapping for the application query.
Computed the current target mapping for the application query.
Start updating the target mappings for the application query.
ADMA5075I: Editing of application query started.
ADMA5058I: Application and module versions are validated with versions of deployment targets.
ADMA5005I: The application query is configured in the WebSphere Application Server repository.
ADMA5005I: The application query is configured in the WebSphere Application Server repository.
ADMA5005I: The application query is configured in the WebSphere Application Server repository.
ADMA5005I: The application query is configured in the WebSphere Application Server repository.
ADMA5113I: Activation plan created successfully.
ADMA5011I: The cleanup of the temp directory for application query is complete.
ADMA5076I: Application query edited successfully. The application or its web modules may require a restart when a save is performed.
Target mapping is updated for the application query.

Start saving the configuration.

Configuration save is complete.

Open a brower and try to access the admin console

https://192.168.33.113:9043/ibm/console/



Reference:

  1.   Vagrant box for WebSphere
  2. WebSphere 8.5 installation on Ubuntu

Sunday, September 27, 2015

Jython Multi Threading in wsadmin

What is the Multi threading?


Multi threading is similar to how multiple programs runs on your computer system, moreover which run at same time. When you are running multiple tasks in parallel on same CPU[machine]. More cores parallel processing allowed by your VM. The simple mapping let me tell you that if you have 1 core CPU that links to Multiple threads.

Do's and Don'ts in threading

Let us talk about does first here:
  1. You defined tasks which are independent of each other
  2. Physics/collision calculations in on thread, graphics in another
  3. All the threads should communicate back with the main thread which actually starts them
Don'ts
  1. If you don't have clarity on multi threading then whole program would mess up! so be-careful

Simple Threading examples on wsadmin

The following sample is from tutorial point python examples.
import threading
import time

exitFlag = 0

class LearnThread (threading.Thread):
    def __init__(self, threadID, name, counter):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name
        self.counter = counter
    def run(self):
        print "Starting " + self.name
        print_time(self.name, self.counter, 5)
        print "Exiting " + self.name

def print_time(threadName, delay, counter):
    while counter:
        if exitFlag:
            thread.exit()
        time.sleep(delay)
        print "%s: %s" % (threadName, time.strftime('%X'))
        counter -= 1

# Main begins here
#Create new threads
thread1 = LearnThread(1, "DevDeploy-1", 1)
thread2 = LearnThread(2, "DevDeploy-2", 2)

# Start new Threads
thread1.start()
thread2.start()

print "Exiting Main Thread"
Here my idea is to use the thread for a development environment deployments. The deployment task you make in a module of function that can be called in run() method of thread would work independently and performs the desired task. My Sample output is as follows:
wsadmin>execfile('F:/pavanbsd/Jython/ThreadEx2.py')
Exiting Main Thread
Starting DevDeploy-2
Starting DevDeploy-1
wsadmin>DevDeploy-1: 21:42:51
DevDeploy-2: 21:42:52
DevDeploy-1: 21:42:52
DevDeploy-1: 21:42:53
DevDeploy-2: 21:42:54
DevDeploy-1: 21:42:54
DevDeploy-1: 21:42:55
Exiting DevDeploy-1
DevDeploy-2: 21:42:56
DevDeploy-2: 21:42:58
DevDeploy-2: 21:43:00
Exiting DevDeploy-2

Jython Date and time formats experiment

Basic date and time formats in Jython

This is common requirement in most of our WAS administration tasks. You need the date or time formats in the following tasks:

  1. Back of the deployment units such as .war or .ear or .jar files
  2. Log file rotations
  3. Monitoring report logs with time stamps
  4. Update the Logger with time stamp
Jython allow us to use time object only from Python module. other two date, datetime objects are not available in Jython. Lets experiments with the time object and its different functions in a simple script:

import time
timetuple=time.localtime()
print "Time tuple:", timetuple
print "Time tuple with loop"
for t in timetuple:
 print t

 # Week of the day
print "Today Weekday in short:",time.strftime('%a')
print "Today Weekday in full:", time.strftime('%A')

# Month  of the date
print "This month in short:", time.strftime('%b')
print "This month in full:", time.strftime('%B')
print "Month as a number", time.strftime('%m')

# Complete date
print "Current date and time : ", time.strftime('%c')

# Time formats
print "Hours in 24 hr clock:", time.strftime('%H') 
print "Hours in 12 hr clock:", time.strftime('%I') 
print "Minute of current time", time.strftime('%M')
print "Seconds in current time", time.strftime('%S')
print "AM/PM Now:", time.strftime('%p')

#  Day formats
print "Day of the Date", time.strftime('%d')
print "Day of the year", time.strftime('%j')


# Week  in numbers
print "Week number of Year:", time.strftime('%U')
print "Weekday as number :",time.strftime('%w')
print "Week number of Year:", time.strftime('%W')
print "Date with regular form:",time.strftime('%x')

print "Time in regular form:",time.strftime('%X')

# Year formats
print "Year in 2 decimals",time.strftime('%y')
print "Year in 4 decimals",time.strftime('%Y')

print "Current Time Zone:", time.strftime('%Z')

Execution of Date and time formats in wsadmin



If you are limited with time object and its functions then you can use Java objects!


wsadmin>execfile('F:/pavanbsd/Jython/DateTimeExperiments.py')
Time tuple: (2015, 9, 27, 19, 27, 47, 6, 270, 0)
Time tuple with loop
2015
9
27
19
27
47
6
270
0
Today Weekday in short: Sun
Today Weekday in full: Sunday
This month in short: Sep
This month in full: September
Month as a number 09
Current date and time :  Sun Sep 27 19:27:47 2015
Hours in 24 hr clock: 19
Hours in 12 hr clock: 07
Minute of current time 27
Seconds in current time 47
AM/PM Now: PM
Day of the Date 27
Day of the year 270
Week number of Year: 39
Weekday as number : 00
Week number of Year: 38
Date with regular form: 09/27/15
Time in regular form: 19:27:47
Year in 2 decimals 15
Year in 4 decimals 2015
Current Time Zone: IST


Exercises: The task might be included like this, a web application bankcustomer.war file backup with appending of today date it should look like bankcustomer.war27092015.
Log file for script trace as was_deploy.log270920152025 [filename+ddmmyyyyhhmm]

References:


  1. Date and Time formats link for Jython

Containerization with Docker

Containerization with Docker
Learn modern microservices containers grow