About Me

My Photo
Satya Ghattu's Blog
I work in a financial company where my team provides Architecture, IT, Engineering & Strategic support to Business applications. I worked for BEA Systems (now Oracle) for more than five years as a Senior Software Engineer mainly in the Operations Administration and Management aspects of WebLogic Platform. I possess vast experience in software development excelling in Middleware & Database Components and Core Java/J2EE technologies. I also lead a few open source projects and a contributor on Dev2Dev. Did I mention that I am the original author of WebLogic Scripting Tool (WLST), the official command line tool for WebLogic Platform. I also hold a few software patents, prior to BEA Systems I worked in variety of software industries in various different roles as a Senior Java developer, Software Analyst and as an Oracle DBA. I have a Masters Degree in Engineering from The University Of Akron, Ohio.
View my complete profile

Monday, October 17, 2005

WLST - BEAWorld session - part 3

Continue reading here

Monday, October 10, 2005

WLST - BEAWorld session - part 2

Continuing with the demo, reaad here

Monday, October 03, 2005

WLST - BEAWorld session - part 1

In BEAWorld this year I had a session on New and Enhanced WebLogic Scripting Tool with the tag line 'Automate the mundane and slay the difficult'. Inspite of being the last session for the whole event I was impressed with the turn out. Before diving deep into my presentation I did a WLST familiarity check and was pleasantly surprised by the number of users in the audience who raised their hands. The familiarity is majorly due to the fact that we released WLST on dev2dev that works for WLS 7.0 and 8.1 (all service packs). BEA very well understands that many of its major customers do not prefer using tools that are not supported. Hence BEA recently announced support for WLST 7.0 and 8.1. So now users can grab the tool from dev2dev and start using it. If you find any problems you can even file a support case and we will resolve the issue.
···As part of my presentation I have demo'ed some new features in WLST that are available OOTB in 9.0 and promised the audience that I will make the demo scripts available via my Blog. The demo included how one could start from scratch and create a full blown domain consisting of servers in a cluster all via few or one single simple WLST script(s). The demo started of with a simple script that loaded a default template that ships with a typical WLS 9.0 installation. The script sets the administration username and password, sets the administration server name to 'myserver' and writes the domain to a directory. Here's the script that is used to setup the default domain.

# Read the default template that comes with WLS installation
print "Read the default domain"
readTemplate("d:/bea/load47/weblogic90/common/templates/domains/wls.jar")
# set the password for default administration user
cd("Security/base_domain/User/weblogic")
cmo.setUserPassword("weblogic")
setOption('OverwriteDomain', "true")
cd("/")
cd("Servers/AdminServer")
cmo.setName("myserver")
writeDomain("d:/bea/mydomain")
print "Done creating and writing the domain"
closeTemplate()


Lets explore how you can enhance this script to do more. We will configure couple of managed servers, create a cluster and add these managed servers to this cluster. In my demo this is exactly what I did after starting the server and while connected to the server. Here we will do all this even before starting the administration server. The script will look as shown below.

# Read the default template that comes with WLS installation
print "Read the default domain"
readTemplate("d:/bea/load47/weblogic90/common/templates/domains/wls.jar")
# set the password for default administration user
cd("Security/base_domain/User/weblogic")
cmo.setUserPassword("weblogic")
setOption('OverwriteDomain', "true")
cd("/")
cd("Servers/AdminServer")
cmo.setName("myserver")
cd("/")
create("ms1","Server")
create("ms2","Server")
create("mycluster","Cluster")
cd("Servers/ms1")
cmo.setListenPort(8001)
cd("/")
cd("Servers/ms2")
cmo.setListenPort(9001)
assign("Server", "ms1,ms2", "Cluster", "mycluster")
writeDomain("d:/bea/mydomain")
print "Done creating and writing the domain"
closeTemplate()


After we had our minimal domain setup, I started a Node Manager using all the defaults. By default the Node Manager Server is started at port number 5556 and all the logs will be written to the directory where WLST is running. For more options check out the help for startNodeManager via help('startNodeManager'). Now once I have the Node Manager up and running, I used the command nmConnect to connect to the Node Manager and started the administration Server. After the server is started I connected to the server. Here's the script that I used.

# start the Node Manager, this starts at
# default port 5556
startNodeManager()
# connect to the NodeManager, the default admin
# username and password can be used
nmConnect("weblogic","weblogic")
# start the server via the NM
nmStart("myserver")
# now disconnect from NM
nmDisconnect()
# connect to the administration server that we just started
connect("weblogic","weblogic")


If you notice I used the administration username and password to connect to the NodeManager server. This is because by default the username and password are set to the administration server's username and password in development mode. If you set up your domain to run in production mode you will have to explicitly set this username and password via the SecurityConfigurationMBean's NodeManagerUsername and NodeManagerPassword attributes. Here's the WLST console output after running both the scripts.

D:\bea\mydomain>java weblogic.WLST

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> execfile("d:/bea/domain.py")
Read the default domain
Done creating and writing the domain
wls:/offline>execfile("d:/bea/start.py")
Launching Node Manager ...
Successfully launched the Node Manager.
The Node Manager process is running independent of the WLST process
Exiting WLST will not stop the Node Manager process. Please refer
to the Node Manager logs for more information.
The Node Manager logs will be under D:\bea\mydomain\.

Connecting to Node Manager ...

Successfully connected.


Starting server myserver

Server myserver started successfully

Successfully disconnected from Node Manager


Connecting to weblogic server instance running at t3://localhost:7001 as username weblogic ...

Successfully connected to Admin Server 'myserver' that belongs to domain 'mydomain'.

Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port
should be used instead.

wls:/mydomain/serverConfig>


To recap what we did so far, I created a minimal domain from a template (that ships with BEA WebLogic Server), started a Node Manager Server, connected to it and started the administration server in the domain we created, disconnected from Node Manager Server and connected to the administration server that we just started.

I will continue the demo in my next blog entry.


Locations of visitors to this page