Create & Delete managed server by wlst script in Weblogic

Requirement – How to create and delete managed server by wlst script in weblogic

Solutions
As we can use wlst recording feature to generate the script.I have modified a script a little bit

Following script to create a managed server with assigning port and machine.

MakeServer.py

name=sys.argv[1]
port=int(sys.argv[2])
machine=sys.argv[3]
connect('weblogic', 'welcome1', 't3://192.168.0.123:7001')
edit()
startEdit()
cd('/')
cmo.createServer(name)
cd('/Servers/' + name)
cmo.setListenAddress("")
cmo.setListenPort(port)
activate()
startEdit()
cmo.setListenPortEnabled(true)
cmo.setJavaCompiler('javac')
cmo.setClientCertProxyEnabled(false)
cmo.setMachine(getMBean('/Machines/' + machine))
cmo.setCluster(None)
cd('/Servers/' + name + '/SSL/' + name)
cmo.setEnabled(false)
cd('/Servers/NewManagedServer/DataSource/NewManagedServer')
cmo.setRmiJDBCSecurity(None)
activate()

->Open terminal and go to
$MWHOME/wlserver_10.3/server/bin
-> . ./setWLSEnv.sh

-> open new terminal
-> go to $MWHOME/user_project/domains/ucm_domains/bin
-> execute . ./setDomainEnv.sh

:-Note it is like dot space dot/setDomainEnv.sh

Call this script as

java weblogic.WLST /u01/app/oracle/Oracle/middleware/wlserver_10.3/server/bin/MakeServer.py "servername" "portNumber" "MachineName"

___________________________________________________________________________________________________________-

Following script to delete server

DeleteServer.py

name=sys.argv[1]
connect('weblogic', 'welcome1', 't3://192.168.0.123:7001')
edit()
startEdit()
cd('/')
cd('/Servers/' + name)
cmo.setCluster(None)
cmo.setMachine(None)
editService.getConfigurationManager().removeReferencesToBean(getMBean('/Servers/' + name))

cd('/')
cmo.destroyServer(getMBean('/Servers/' + name))

activate()

->Open terminal and go to
$MWHOME/wlserver_10.3/server/bin
-> . ./setWLSEnv.sh

-> open new terminal
-> go to $MWHOME/user_project/domains/ucm_domains/bin
-> execute . ./setDomainEnv.sh

:-Note it is like dot space dot/setDomainEnv.sh

Call this script as

java weblogic.WLST /u01/app/oracle/Oracle/middleware/wlserver_10.3/server/bin/DeleteServer.py "servername"

See the video here

happy learning Weblogic with Vinay kumar in techartifact…..

Configure Node Manager in Weblogic and administer Managed server

Requirement – How to configure node manager with weblogic and administer Managed server

Solutions- I have provided below steps to accomplish this task.

-> Should have an machine accroding to Os. Either unix machine or machine
-> Start startNodeManager.sh in $MW_HOME/server/bin
-> Check if nodeManager.properties files is there
-> If file is there then make StartScriptEnabled=true
-> Then go to $MW_HOME/wlserver_10.3/common/bin
-> then go with command – ./wlst.sh
-> then go with command – connect(‘weblogic’,’welcome1′,’t3://192.168.228.134:7001′)
-> then type command – nmEnroll(‘/u01/app/oracle/Oracle/middleware/user_projects/domains/ucm_domain’,’/u01/app/oracle/Oracle/middleware/wlserver_10.3/common/nodemanager’)
-> If you successfuly enrolled then go to admin console and start managed server.
-> Then be happy and smile…..

Now you can see this video as well.

Happy Learning Weblogic with Vinay Kumar in techartifact……

Resolved- [Management:141191]The prepare phase of the configuration update failed with an exception

While working in python script, i got this error.I found cause of the error is , i have an up and running managed server and i deleted that managed server through an wlst script.
While deleting server, when implement activate method in script i got this large and ugly error.-

An error occurred during activation of changes, please see the log for details.
Message icon – Error [Management:141191]The prepare phase of the configuration update failed with an exception:

Solutions-
-> First thing never try to delete any managed server which is up and running.First shut down and then closed it.

Follow below steps to get rid of this error

-> Stop the Admin Server & Managed Servers which is up and running.
-> On your Admin Server cd to $WLS_HOME\user_projects\domains\base_domain.
-> Delete all files in pending and servers/domain_bak directory.
-> Start the Admin Server & Managed Servers.
-> Login the weblogic Admin Console and click on ReleaseConfiguration button.
-> Perform the same changes now.

Thats it. 🙂

Happy weblogic learning with Vinay Kumar in techartifact….