Posts

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 Installing Jython in Thin Client Home 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 installatio...

Setup WebSphere 8.5 on Ubuntu Vagrant box

Image
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 Download and install Vagrant  for Windows Download and install Oracle VirtualBox 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...

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: You defined tasks which are independent of each other Physics/collision calculations in on thread, graphics in another All the threads should communicate back with the main thread which actually starts them Don'ts 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): ...

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: Back of the deployment units such as .war or .ear or .jar files Log file rotations Monitoring report logs with time stamps 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('%...

Creating cluster using Jython wsadmin

Pre requisites  As per todays experiment what I understood is we need the following are the pre-requisites for the Cluster configuration in WebSphere Environment: 1) Cell created with a DMGR Profile 2) Nodeagents created and added to the cell. 3) Dmgr, Nodeagent must be running. Jython Script for Cluster import sys import os import socket #Get the operating system line separator from the linesep method of the os object nl = os.linesep # Store the Cell identifier for the specified Cell cellID = AdminConfig.list('Cell') cellName = AdminConfig.showAttribute(cellID, 'name') #derives the environment type from the cellName sName = cellName.replace("Cell","") sName = sName.replace("Demo","") # Store the Node identifier for the specified Node nodeIDs = AdminConfig.list('Node').split(nl) nodeNames = AdminTask.listNodes().split(nl) nodeNames.sort() # Identify each node and it's purpose so we can start creating s...

Creating New Server using Jython

Image
In this learning and sharing today created a server using Jython script. The basic needs to create a App Server in WebSphere environemnt is to have Node and it should be added to the Cell. The script would perormed with the help of the NodeID to create the server. create is the simple command method on the AdminConfig object. CreateServer.py import sys # import system libraries #interactive method, type server & node name servername=raw_input("Enter server name:") nodename=raw_input("Enter Node name:") # get the config id of the node print "getting config id of node .." nodeid=AdminConfig.getid('/Node:'+nodename+'/') # verify whether the entered node exist or not try : if nodeid=='': print "entered correct node", nodename except: print " the node does not exist, please enter a valid node" # get the config id of the node #print "getting config id of node .." #nodeid=AdminConfig.getid...

Getting Node id, Cell ID, Server ID of Mbean in wsadmin

Image
Hey automation expert welcome to another interesting exploration on wsadmin basic commands that could build your Jython script much effectively. Let's jump into it. Basic understanding of wsadmin objects Here I've listed out what we need to consider as wsadmin objects which could help as build blocks for your Jython based automation scripts. Node – an individual system, either physical or virtual Node Manager – the process controlling the individual node and all servers in all cells, it executes the commands of the Deployment Manager Profile – a WebSphere entity similar to a node concept wise Application Server – a Java Virtual Machine (JVM) process Application – a Java enterprise application it could be .ear file with some modules Cluster – a group of Servers, all running the same applications Cell – an administrative domain of one or more servers Deployment Manager (DM) – the administration application for a cell How do all these pieces work togeth...