Weblogic Admin Tasks Using Command Line Utility



Weblogic Admin Tasks Using Command Line Utility

Today we will learn how to use weblogic command line utilities to perform serveral administration tasks. Weblogic server provides lot of command line utilities to create,configure,manage all the weblogic resources like servers,clusters,machines,connection pools,machines etc.
Advantages include, we can integrate this command line utilities in batch files,ant, shell scripts for execution. For example if we need to replicate the same production/dev environment in several machines, this scritps are very useful and just we need to change some variables according to environment.
Now we will use “weblogic.Admin” command line utility (user friendly utility in weblogic). First we will set the environment by executing ”setDomainEnv.cmd” .
First we will create a managed server on port 8201 using weblogic.Admin utility.
 C:OracleWeblogicuser_projectsdomainsTD1>java weblogic.Admin -url localhost:
7001 -username weblogic -password weblogic1 CREATE -mbean
“TD1:Name=TestMS1,Type=Server”

By executing the above command , TestMS1 has been created but on admin port. To change the listen port execute the below command.
C:OracleWeblogicuser_projectsdomainsTD1>java weblogic.Admin -url localhost:
7001 -username weblogic -password weblogic1 SET -mbean
“TD1:Name=TestMS2,Type=Server” -property ListenPort 8201

Follow the above steps to create one more managed server with name “TestMS2″.
Now create a cluster and assign multicast address using below commands :
C:OracleWeblogicuser_projectsdomainsTD1>java weblogic.Admin -url localhost:
7001 -username weblogic -password weblogic1 CREATE -mbean
“TD1:Name=TestCluster,Type=Cluster”

C:OracleWeblogicuser_projectsdomainsTD1>java weblogic.Admin -url localhost:
7001 -username weblogic -password weblogic1 SET -mbean
“TD1:Name=TestCluster,Type=Cluster” -property “MulticastAddress” “224.198.0.1″

We will assign the managed server to cluster as below:
C:OracleWeblogicuser_projectsdomainsTD1>java weblogic.Admin -url localhost:
7001 -username weblogic -password weblogic1 SET -mbean
“TD1:Name=TestMS1,Type =Server” -property Cluster “TD1:Name=TestCluster,Type=Cluster”

Repeat the above execution for adding TestMS2 in cluster.
To view configuration attributes of a particular Mbean, use weblogic.Admin GET:
C:OracleWeblogicuser_projectsdomainsTD1bin>java weblogic.Admin -url localh
ost:7001 -username weblogic -password weblogic1 -pretty GET -type ServerConfig
where ConfigMBean could be ServerConfig, ExecuteQueueConfig, DomainConfig, and so on.