Hi,
Here is a Simple WLST script which can be used to get the Current State of all the applications deployed in a Domain.
Step1). Now open a Command prompt then run “. ./setWLSEnv.sh”
Step2). Run the WLST Script like following: (below Image has the screenshot of Script)
java weblogic.WLST application_status.py
The WLST Script is mentioned below which is simplest and Formated WLST Script … Which doesnt display the Internal WebLogic’s Applications and Makes it more readable and Clean to analyze the state of our Actual Deployed Applications.
connect('weblogic','weblogic','t3://localhost:7001') cd ('AppDeployments') myapps=cmo.getAppDeployments() for appName in myapps: domainConfig() cd ('/AppDeployments/'+appName.getName()+'/Targets') mytargets = ls(returnMap='true') domainRuntime() cd('AppRuntimeStateRuntime') cd('AppRuntimeStateRuntime') for targetinst in mytargets: curstate4=cmo.getCurrentState(appName.getName(),targetinst) print '-----------', curstate4, '-----------', appName.getName()
.
.
Thanks
Jay SenSharma
May 21st, 2010 on 3:44 pm
hi,very good knowledge about weblogic and trick.
I wonder is it possible that to check status servers,clusters,datasource this way.
another question;
I download weblogic server 11g and install ,I start to adminserver ask username and password. How to pass these parameters?
it is possible to make windows service for adminserver but I could not. do you have advice,sample for me
best regards..
May 24th, 2010 on 3:42 am
Hi Erdem,
I am really very sorry for late response. Your post got messed up in other querries…
QUERY-1:
it is possible to make windows service for adminserver but I could not. do you have advice,sample for me
Yes, it is possible to Make AdminServer as WINDOWS SERVICE. You need to follow the same stem mentioned in http://middlewaremagic.com/weblogic/2010/03/13/managed-server-as-windows-service/….Except providing the Managed Server Name in that script Please provide the AdminServer Name:
set SERVER_NAME=AdminServer
QUERY-2:
I download weblogic server 11g and install ,I start to adminserver ask username and password. How to pass these parameters?
If you dont want to provide the Username & Password again & again …while restarting your Servers…then Follow the below Steps:
Step1). move inside “servers\security” and create a file with name “boot.properties” here
Example: C:bea11guser_projectsdomains7001_DomainserversAdminServersecurity> vi boot.properties
Step2). inside “boot.properties” file just write the below two lines: (suppose your AdminServer Username is : weblogic and Password is : weblogic1)
username=weblogic
password=weblogic1
Step3). restart your Server…
Step4). In the Successful restart of your server …you will see that the username & password entered in “boot.properties” got encrypted …and next time you need not to provide the username & password while starting your Servers.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
June 28th, 2010 on 8:00 pm
Hi,
i have a problem about getting application state on a specific target.
i wanna give an example, so i can easily explain my problem.
cd (‘AppDeployments’)
myapps=cmo.getAppDeployments()
for appName in myapps:
domainConfig()
cd (‘/AppDeployments/’+appName.getName()+’/Targets’)
mytargets = ls(returnMap=’true’)
domainRuntime()
cd(‘AppRuntimeStateRuntime’)
cd(‘AppRuntimeStateRuntime’)
for targetinst in mytargets:
curstate4=cmo.getCurrentState(appName.getName(),targetinst)
after running this code, i’ll get STATE and TARGET.
for some example applications, this alert started to give me message “look, this application is in prepared state on this managedserver/cluster”. but application is running perfect and users do not have problem with it.
When i looked up from admin console, application state is active. But when i clicked “active”, two states seen. One of them is consolidated state which is active, the other is target-specific state which is prepared. So consolidated state is seen on deployments page. But i got the target-specific state from wlst.
So what is the problem? Which is the actual state of an application? How can i get true state from wlst?
best regards..
June 29th, 2010 on 4:09 pm
Hi Yusuf,
I tested the same Script as you have mentioned …In WLS10.3 with 4 Different Applications deployed on the Server. I can see that every thing is working as expected. Here is the Screen shot of the Output and the Script: http://middlewaremagic.com/weblogic/wp-content/uploads/2010/06/App_State.jpg
I m not sure which version of WLS are u trying. But it looks like there may be some of the components in your App in Unhealthy state which may be giving the state as prepared. Can u please elaborate more on this. Means Are u facing this issue only with a Perticular applicaton? Do u see any WARNNING while deploying those applications which are being dispayed as PREPARED in the WLST output?
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
July 15th, 2010 on 6:20 pm
Hi Yusuf,
If you have deployed the application on a cluster(m1,m2) or more than 1 managed server(m1,m2)
Say, the application is in active state on m1 and prepared on m2.
Then the consolidated state would be active. because the application is still able to server the requests(This is the reason console shows it so). But, only m1 will serve these requests.
The target specific state will be active on m1 and prepared on m2.
This script gives you fine grained states according to the targets so that you check if there are some issues with the application on any particular server.
As long as the application is active for any of the servers you can consider it active.However,the true states would be according to targets.
July 26th, 2010 on 5:21 pm
thanx both of you guys
August 10th, 2010 on 7:07 pm
Hi Jay / Neeraj,
I’m using WLST interpreter in my Java code and use it
to run WLST commands and scripts.
My Java Code is as follows:
public class MyCreateMSandClus {
static InteractiveInterpreter interpreter = null;
public MyCreateMSandClus() {
interpreter = new InteractiveInterpreter();
}
public static void connect() {
StringBuffer connectBuff = new StringBuffer();
try {
String conStr = “connect(‘weblogic’,’welcome123′,’t3://localhost:7005′)”;
connectBuff.append(conStr);
interpreter.exec(connectBuff.toString());
}catch(PyException pyex) {
System.out.println(“Connection fails !!!”);
pyex.printStackTrace();
}catch(Exception ex) {
ex.printStackTrace();
}
}
public static String startTransaction() {
StringBuffer buf = new StringBuffer();
buf.append(“edit()n”);
buf.append(“startEdit()n”);
return buf.toString();
}
private static void createServers() {
StringBuffer buf = new StringBuffer();
buf.append(startTransaction());
buf.append(“man1=create(‘msEmbedded1′,’Server’)n”);
buf.append(“man2=create(‘msEmbedded2′,’Server’)n”);
buf.append(“clus=create(‘clusterEmbedded’,’Cluster’)n”);
buf.append(“man1.setListenPort(7331)n”);
buf.append(“man2.setListenPort(7334)n”);
buf.append(“man1.setCluster(clus)n”);
buf.append(“man2.setCluster(clus)n”);
buf.append(endTransaction());
buf.append(“print ‘Script ran successfully …’ n”);
interpreter.exec(buf.toString());
}
private static String endTransaction() {
StringBuffer buf = new StringBuffer();
buf.append(“save()n”);
buf.append(“activate(block=’true’)n”);
return buf.toString();
}
public static void main(String[] args) {
new MyCreateMSandClus();
connect();
try {
createServers();
}catch(Exception ex) {
ex.printStackTrace();
}
}
I’m doing in Eclipse where PyDev plugin is installed. In the eclipse build classpath weblogic.jar also added but it is throwing “NameError: connect…”
Connection fails !!!
Traceback (innermost last):
File “”, line 1, in ?
NameError: connect
Traceback (innermost last):
File “”, line 1, in ?
NameError: edit
Any idea how to resolve it ?
I was not able to post / add reply in the WLST page as it was allowing me to logging in. So I’m posting here.
August 11th, 2010 on 11:34 am
Hi Jyoti,
Please donot use “interpreter = new InteractiveInterpreter();” rather use “interpreter = new WLSTInterpreter();”
Your Code:
public class MyCreateMSandClus {
static InteractiveInterpreter interpreter = null;
public MyCreateMSandClus() {
interpreter = new InteractiveInterpreter();
}
Changed Code:
import java.util.*;
import weblogic.management.scripting.utils.WLSTInterpreter;
import org.python.util.InteractiveInterpreter;
public class MyCreateMSandClus {
static InteractiveInterpreter interpreter = null;
public MyCreateMSandClus() {
interpreter = new WLSTInterpreter();
}
Why to do so?
Because:
public class weblogic.management.scripting.utils.WLSTInterpreter extends org.python.util.InteractiveInterpreter
To Achieve WebLogic functionality u must instentiate “weblogic.management.scripting.utils.WLSTInterpreter” object.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
August 24th, 2010 on 11:17 pm
i am using weblogic 8.1.3 in windows, and i have added jython.jar and wlst.jar and i have updated the classpath with these two files in the setWLSEnv.cmd. i am able to start WLST by java weblogic.WLST. Also , i am able to connect to a running admin server. But, when i type edit(), startEdit, or any command, it says
Traceback (innermost last):
File “” line 1 in ?
NameError: edit
Traceback (innermost last):
File “” line 1 in ?
NameError: startEdit()
etc. And, when i use cd(‘Servers/AdminServer’)
it says
WLSTException: Error occured while performing cd : could not find the MBean instance.
I could do the same steps in weblogic 9.2 version.
I am actually trying to use wlst commands to update the admin port.
and i am unable to do it in weblogic version 8.1.3 because of the above errors.
Jay, can you please help me
Thanks in advance
August 24th, 2010 on 11:49 pm
Hi Rakesh,
In WLS8.1.3 you cannot use WLST Online commands. Means Commands which requires to establish the Connection to the AdminServer before are called as Online Commands.
Full Support for Online commands are added in WebLogic 9.1 through WLST. Some of the Online commands were introduced in WLS8.1 SP6 as well.. but those are very less. Full support for WLST Online commands are available from WLS9.x onwards.
Thats why edit() and startEdit() commands will not work for you in WLS8.1
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
September 2nd, 2010 on 10:29 pm
Thanks guys. Your small “app state” listing has taught me more about the querying the WL structure via WLST than anything else. I appreciate it – hope I can return the favor with some samples when I get better at this.
September 2nd, 2010 on 10:39 pm
Hi Guffey,
Thanks for visiting WebLogic Wonders and giving us courage.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
September 3rd, 2010 on 11:41 am
Hi Guffey,
Glad tht the script could help you.
Really appreciate your willingness to share you knowledge and would love if you could share your learning with the rest of us.
weblogic wonders is all about free knowledge sharing.
Cheers,
Neeraj
September 14th, 2010 on 5:10 pm
Hi Neeraj I am getting below error while running script-
Can you please explain this . I am using Weblogic 9.2 MP3
File “/u001/wls9/bea/user_projects/domains/certdomain/applicationstatus.py”, line 9
cd(app)
^
SyntaxError: invalid syntax
September 15th, 2010 on 10:23 am
Hi Rajanibasa,
Looks like there is some minor mistake in your WLST script. Please post the Script which you are using.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
March 3rd, 2011 on 5:24 pm
hi jai,
I am the new user of this site.its very help full.just i need wlst script for configure xml registry to target selected server using properties file….especially i want logic for target xml regestry to application deployment servers….please help me…
March 3rd, 2011 on 5:44 pm
Hi Varunkolanu,
You can use the following WLST Script to create the XML Registry … I used AdminServer as a target …in your case u can change the AdminServer to some Managed Server.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
March 3rd, 2011 on 5:54 pm
hi jai,
thanks for reply…actually i am trying to configure xml registry using properties file concept. but i am getting lot of exceptions…so please i need properties file concept.
March 3rd, 2011 on 8:54 pm
Hi Varunkolanu,
Please refer to the new article we developed based on your query: http://middlewaremagic.com/weblogic/?p=5982
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
March 3rd, 2011 on 11:17 pm
Hi jai,
Thanks for quick reply…..
April 18th, 2011 on 4:34 pm
Hi Jay,
I’m getting the below exception when I tried to execute the script you provided in this blog.
[oracle@testhost kiran]$ java weblogic.WLST application_status.py
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Problem invoking WLST – Traceback (innermost last):
(no code object) at line 0
File “/home/oracle/kiran/application_status.py”, line 3
myapps=cmo.getAppDeployments()
^
SyntaxError: invalid syntax
Could you please let me know what is wrong here ?
Thanks in advance.
Regards,
Kiran
April 18th, 2011 on 10:23 pm
Hi Kiran,
The script is tested Successfully in WebLogic 9.x , WLS 10.x and WLS11g So if you are using WLS8.1 …then please don;t use it. Or use the Copy and pasted script without any modification in it and it willl just work fine. If you are still facing any issue then please send us your script with the exact version details of your WebLogic.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
April 20th, 2011 on 5:27 pm
Hello Jay,
I’m currently using Oracle Weblogic 11g, I just tried to change the credentials and the URL for the domain. Any constraints that I need to run the script from a particular directory ?
Regards,
Kiran
April 20th, 2011 on 6:01 pm
HI Kiran,
Better if you test it…..Self practice of many things are much better than querying. If you get any Error/Exception then please post it with details.
In One line the answer to your query will be … “If you will change the credentials of your AdminServer then you should also change the Credentials in the WLST/ANT scripts to access Server Resources.”
.
.
Thanks
Jay SenSharma
April 20th, 2011 on 5:49 pm
Hello Jay,
Please find the script below:
connect(‘test’,’test1234′,’t3://localhost:7001′)
cd (‘AppDeployments’)
myapps=cmo.getAppDeployments()
for appName in myapps:
domainConfig()
cd (‘/AppDeployments/’+appName.getName()+’/Targets’)
mytargets = ls(returnMap=’true’)
domainRuntime()
cd(‘AppRuntimeStateRuntime’)
cd(‘AppRuntimeStateRuntime’)
for targetinst in mytargets:
curstate4=cmo.getCurrentState(appName.getName(),targetinst)
print ‘———–‘, curstate4, ‘———–‘, appName.getName()
And we are currently using Weblogic 10.3.3.
Regards,
Kiran
April 20th, 2011 on 6:03 pm
Hi Kiran,
Script looks good and correct. It Depends How you run it. The Indentation is most important in WLST Scripts. Because the Control Statements like if……else and for….while Loops are started and Ended according to the Indentations. Indentation means the spaces leading and trailing to the stetements/Words
.
.
Thanks
Jay SenSharma
April 20th, 2011 on 11:17 pm
Hello Jay,
Thanks for your comments but as a matter of fact the indents are just as the way your source script is but while I have posted here the indents have disappeared.
Well as you said I’ll try to practice and see if I can fix it.
Regards,
Kiran
May 1st, 2011 on 1:35 am
Hi, if the server is ssl, like https://host:port, then it cannot connect to the server. What shall I do? Create a certificate? but how?
Thank you
May 1st, 2011 on 12:55 pm
Hi dsong99,
If you have enabled HTTPS port on your server without creating any certificate then it means your server is using WebLogic default keystore certificates as “DemoTrust” in that case if you want to connect to AdminServer then First of all please check your AdminServer log whether it started Listening on the HTTPS secure port or not….?
If yes then please use the below command to try to connect to WebLogic to see Error Stack trace if it fails to connect to find out the root cause….
java -Dssl.debug=true -Dweblogic.security.SSL.ignoreHostnameVerification=true -Dweblogic.security.TrustKeySore=DemoTrust weblogic.Admin -username weblogic -password weblogic -url t3s://AdminPort:securePort PING
As mentioned in the following link: http://download.oracle.com/docs/cd/E13222_01/wls/docs81/admin_ref/cli.html#1336082
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
May 1st, 2011 on 5:54 pm
Hi dsong99,
To know how to create SSL Certificates and how to associate it with WebLogic….Please refer to the following:
http://sureshsvn.com/installing_ssl_weblogic.html
AND
http://m-button.blogspot.com/2008/11/how-to-configure-weblogic-to-use-ssl.html
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
July 6th, 2011 on 11:08 pm
Hi Jay,
Can this script be scheduled to run at an fixed interval of 1 hour or so?? If so how do we do that? Do we have to run this script every time we need the current state of our applications? I am looking for something which emails me when the applications state goes to prepared or failed …
July 7th, 2011 on 6:15 pm
Hi middleware_guy,
We have just created an article based on your query which would fulfill your requirement, you can call this script using the cron-job utility and can set it as per your requirement. Have a look at the below article.
Topic: Sending Email Alert for Application Current State
http://middlewaremagic.com/weblogic/?p=7042
Regards,
Ravish Mody
July 8th, 2011 on 12:10 am
Thanks Ravish but I am having issues using the script. I have posted in that article link.
Appreciate all the help! Keep up the good work 😉
July 13th, 2011 on 5:22 am
Hello, while trying to run your App_State.py I get the following error, I have no clue whats going on, can any of you guys help me out?
edwin@edwin-laptop:~$ java weblogic.WLST App_State.py
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3://localhost:7011 with userid weblogic …
Successfully connected to Admin Server ‘MedRecServer’ that belongs to domain ‘medrec’.
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.
Location changed to serverRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainConfig)
No stack trace available.
Problem invoking WLST – Traceback (innermost last):
File “/home/edwin/App_State.py”, line 6, in ?
File “”, line 182, in cd
File “”, line 1848, in raiseWLSTException
WLSTException: Error cding to the MBean
July 13th, 2011 on 9:46 am
Hi Edwin_Romero,
The above WLST ecript is intended to be used from WLS9.x onwards, It will fail if you will try to use it in WLS8.1. So please let us know if you are using WLS8.1 because MBeans have changed from WLS 9.x onward.
If you are using WLS9.x onwards WebLogic Server then the Script will run fine without any issue. The only thing we need to keep in mind that The Indentations are correct Means The Spaces in the beginning of the lines are very important. Because WLST script For Loops and If—else Blocks works on the Indentation.
.
.
Keep Posting 🙂
Thanks
Jay Sensharma
July 30th, 2011 on 3:20 am
Hi Jay,
i used a wlst scipt to update the http log format and i am getting the follwoing error.
weblogic version:- WebLogic Server Version: 10.3.0.0
script:-
connect(‘weblogic’,’XXXXX’,’t3://localhost:7001′)
edit()
startEdit()
svrs = adminHome.getMBeansByType(‘Server’)
for s in svrs:
name = s.getName()
cd(‘/Servers/’ + name + ‘/Log/’ + name)
cmo.setELFFields(‘c-ip date time time-taken bytes cs-method cs-uri sc-status’)
activate()
disconnect()
error:-
Starting an edit session …
Started edit session, please be sure to save and activate your
changes once you are done.
Problem invoking WLST – Traceback (innermost last):
File “/tmp/log3.py”, line 8, in ?
AttributeError: setELFFields
i ran this script using wlst.sh .py
can you help in fixing this issue.
July 30th, 2011 on 3:42 am
Hi Kimjim,
You are trying to use “adminHome” inside your WLST Script which is wrong because from WLS9.x onwards has been Deprecated. Instead of using this API-like programming model, all JMX applications should use the standard JMX programming model, in which clients use the javax.management.MBeanServerConnection interface to discover MBeans, attributes, and attribute types at runtime. In this JMX model, clients interact indirectly with MBeans through the MBeanServerConnection interface. adminHome is basically an instance of weblogic.management.MBeanHome.
So please use the latest style of WLST Script . For more information on this please refer to http://download.oracle.com/docs/cd/E12840_01/wls/docs103/upgrade/compat.html#wp1111114
To get all the Server Names you should use the following : http://middlewaremagic.com/weblogic/wp-content/uploads/2010/04/wlst_ant.jpg without using adminHome.
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
July 31st, 2011 on 4:43 am
Hi Jay,
Thanks for your quick reply really appreciate it.
i tried as you said.
but unable to execute it.
connect(‘weblogic’,’xxxxxxxx’,’xxxxxxxxxxxxxxx’)
commitTransaction()
try:
domainConfig()
cd(‘/Clusters’)
cd(clusterName)
managedServers=cmo.getServers()
print ‘Found ‘ + `len(managedServers)` + ‘ managed servers’
except:
print ‘Error navigating DomainConfig MBean tree for the list of managed servers’
for managedServer in managedServers:
try:
print ‘tt===============================================’
serverName = managedServer.getName()
cd(“/Servers/”+servername+”/WebServer/”+servername+”/WebServerLog/”+servername)
cmo.setLogTimeInGMT(false)
cmo.setLogFileFormat(‘common’)
cmo.setELFFields(‘c-ip date time time-taken bytes cs-method cs-uri sc-status’)
except java.lang.Exception, ex:
sysOut(“Exception on getClusterAppStatus: ” + ex.toString() )
Error:-
invalid syntax: , line 14, pos 18
>>>
can you give any suggestion to make it work.
Thanks,
Kim.
July 31st, 2011 on 3:37 pm
Hi Kim,
Would suggest you to send us the above WLST script and any of its dependence files on the mail id contact@middlewaremagic.com and would try to debug your issue.
Regards.
Ravish Mody
July 31st, 2011 on 6:45 pm
Hi Kimjim,
We developed a Simple WLST Script for WLST 10.3.x to change the Log related settings, (This script will be suitable for any WLS version which is higher than or equal to WebLogic 9.x), Please refer to the following article:
http://middlewaremagic.com/weblogic/?p=7149
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
August 1st, 2011 on 8:14 pm
Hey Jay
Thanks Man this an awesome script .
This saved me a lot of time and thank you for all your help.
Thank You very much once again.
November 25th, 2011 on 3:46 pm
when i run the application provided by you it is showing as follows..
C:>java weblogic.WLST application_status.py
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Problem invoking WLST – java.io.FileNotFoundException: C:\application_status.py (The system cannot find the file specified)
Can you please tell me how to overcome this issue, its urgent.
Thanks in advance…
November 25th, 2011 on 6:00 pm
Hi adityakrishnarao,
By default we need not to specify the complete absolute PATH of the WLST script like “C:application_status.py ” if the file is present in the same directory from where we are running the WLST command….
However if you are facing this issue then please try specifying the absolute PATH of the WLST Script with a path delimiter as Forward Slash…
Example:
C:>java weblogic.WLST C:/application_status.py
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
November 28th, 2011 on 10:41 am
Hi Jay,
I tried using the absolute path also but the result is same. I saw in one post that we need to download weblogic.jar, jython.jar, wlst.jar and we need to set the classpath of all these jars?????
The error is as follows …
C:>java weblogic.WLST C:OracleMiddlewareapplication_status.py
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Problem invoking WLST – java.io.FileNotFoundException: C:OracleMiddlewareapplication_status.py (The system cannot find the file specified)
December 5th, 2011 on 2:58 pm
Hi JaySenSharma,
I had installed Oracle Weblogic Server11g in Windows xp.
I am getting an issue while running wlst Can you please tell me how to solve this issue in weblogic…
When i run your first code it is showing it is giving error as follows…
C:>java weblogic.WLST C:OracleMiddlewareapplication_status.py
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Problem invoking WLST – java.io.FileNotFoundException: C:OracleMiddlewareapplication_status.py (The system cannot find the file specified)
1)I tried using forward and backward slash also as per your suggestion, but no use.
2)I had set the classpath for weblogic server in environment variables also
classpath= C:OracleMiddlewarewlserver_10.3serverlibweblogic.jar;C:Program FilesJythonjython.jar;C:OracleMiddlewarewlserver_10.3serverbinsetWLSEnv.cmd.
Thanks in advance ….
December 5th, 2011 on 4:00 pm
Hi Adityakrishnarao,
As you have already tried couple of things … Try the following as well open a command prompt and then do the following :
cd C:OracleMiddleware
dir
NOTICE: do you see the file name as “application_status.py.txt” OR “application_status.py” ?
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
December 6th, 2011 on 12:43 pm
Hi JaySenSharma,
As per your suggestion i had checked in command prompt about it gave me application_status.py (created this file using Notepad++) only and in other file it gave application_status.py.rtf (created this file using Notepad).
Waiting for your reply…..
With Regards,
Aditya Krishna Rao.
December 6th, 2011 on 1:36 pm
Hi JaySenSharma,
I came through that above error, there is a small mistake in saving the application. I did in notepad and saved the file extension with .py then its working. Earlier i worked in Notepad++, but gave me the error although the format is same. But now i landed up with new error can you help me. The program is as follows…
connect( ‘weblogic’, ‘Aditya1986’, ‘t3://localhost:7001′, adminServerName=’AdminServer’ )
print ‘deploying….’
deploy(‘calendarapp’, ‘C:Calendar.war’, targets=’AdminServer’)
startApplication(‘calendarapp’)
print ‘disconnecting from admin server….’
disconnect()
exit()
print ‘*** WEBLOGIC : STOP ***’
The Error which i am getting while executing the script is as follows….
C:>java weblogic.WLST deploy.py
Initializing WebLogic Scripting Tool (WLST) …
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Problem invoking WLST – Traceback (innermost last):
(no code object) at line 0
File “C:\deploy.py”, line 3
print ‘deploying….’
^
SyntaxError: invalid syntax
December 6th, 2011 on 2:44 pm
HI Aditya,
While using WLST Script on Windows systems make sure that the PATH separator is Forward Slash (Don;t use the usual Back shlash path separator)
Example:
C:Calendar.war ———- This is wrong
Example
C:/Calendar.war ————–This is RIGHT
Or use character “r” before the path
Example:
deploy(‘calendarapp’, ‘C:Calendar.war’, targets=’AdminServer’) ————-WRONG
deploy(‘calendarapp’, r‘C:Calendar.war’, targets=’AdminServer’) ————-RIGHT
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
December 7th, 2011 on 12:29 pm
Thanks JaySenSharma for your suggestion.
December 7th, 2011 on 12:31 pm
Thanks JaySenSharma for your suggestion. I had successfully executed the script. Anyhow thanks once again. I will keep posting new issues..
With Regards,
Aditya Krishna Rao.
October 4th, 2012 on 11:32 am
HI
Is there any way in connect(), i need not to mentioned the password or can i use encrypt password..something like that?
Thanks
Rajan Grover
February 23rd, 2014 on 12:32 am
Hi,
I have 2 ear applications which needs to be stopped and undeployed.
I have updated the above script to stop the application and undeploy as below. Once the script is executed stop and undeploy happens only for 1 apllication. Other application fails with the below error
Script
def undeployApplication():
cd (‘AppDeployments’)
myapps=cmo.getAppDeployments()
for appName in myapps:
domainConfig()
cd (‘/AppDeployments/’+appName.getName()+’/Targets’)
mytargets = ls(returnMap=’true’)
domainRuntime()
cd(‘AppRuntimeStateRuntime’)
cd(‘AppRuntimeStateRuntime’)
for targetinst in mytargets:
curstate4=cmo.getCurrentState(appName.getName(),targetinst)
print ‘———–‘, curstate4, ‘———–‘, appName.getName()
deploymentName=appName.getName()
deploymentTarget=targetinst
print deploymentName
print deploymentTarget
stopApplication(deploymentName, targets=deploymentTarget)
undeploy(deploymentName, targets=deploymentTarget)
Error:
File “”, line 1116, in domainConfig
File “”, line 1848, in raiseWLSTException
WLSTException: Error cding to the MBean
Can you please help me to fix the issue?
September 28th, 2015 on 11:22 am
Hi,
I am trying the script given but when i create a .py file and try to execute it i am getting the following error.
[root@localhost bin]# java weblogic.WLST application_status.py
Error: Could not find or load main class weblogic.WLST
Thanks in advance.
September 28th, 2015 on 2:57 pm
Hello Om,
You need to make sure that the required JARs are added to the classpath of the terminal (command prompt) where you are trying to start the WLST. You can achieve it as following:
Open a Command Window and then run the “setWLSEn.cmd” (for windows)… or “setWLSEnv.sh” (for Unix Based OS) Then run the WLST Script :
NOTE: Run the setWLSEnv.sh always with proceeding two DOTs like: “. ./setWLSEnv.sh”. The first DOT represents that set the Environment in the current Shell, AND the second ./ represents execute the script from the current directory.
See Step-4 for more detail: http://middlewaremagic.com/weblogic/?p=2691 for more detail on this.
Regards
Jay SenSharma