WLST - writeDomain command

hi guys,
i'm trying to write my domain using WLST writeDomain command.
it works perfect if i give it a full path i.e.
writeDomain("/home/cmp/domains/cmpDomain")
but if i try relative path such as:
writeDomain("~/domains/cmpDomain")
or
writeDomain("$HOME/domains/cmpDomain")
it doesn't work :(
i also looked for a way to pass a parameter to the WLST, but didn't find one.
i can't use hardcoded full path because i'm writing a generic install kit....
any ideas?
thanks,
zilbi

Hello,
shutdown(svrName, force='true')
will perform a forced shutdown.
Regards,
Adam

Similar Messages

  • WLST writeDomain() error

    Hi,
    Did a script to create a domain that uses Wlst offline (wls9.1)
    once I set a couple of parameters I invoke the writeDomain() command to write the domain to directory i get this
    command:
    newDomain=domainDirectory+'/'+domainName
    writeTemplate(newTemplate)
    writeDomain(newDomain)
    error:
    Error: writeDomain() failed. Do dumpStack() to see details
    begining of dumpstack()
    com.bea.plateng.domain.script.jython.WLSTException: com.bea.plateng.domain.script.ScriptException:
    om.bea.plateng.domain.GenerationException: Error <u>creating JarHelper</u>
    Root Cause: java.io.FileNotFoundException: D:\bea91\_configtmp\_bea5226tmp
    at com.bea.plateng.domain.script.jython.CommandExceptionHandler.handleException(CommandExce
    tionHandler.java:51)
    at com.bea.plateng.domain.script.jython.WLScriptContext.handleException(WLScriptContext.jav
    :1333)
    at com.bea.plateng.domain.script.jython.WLScriptContext.writeDomain(WLScriptContext.java:70
    at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)
    java.lang.Object;(Unknown Source).....
    I don't understand the error
    Ashanty
    Message was edited by:
    Ashanty

    Hi,
    Did a script to create a domain that uses Wlst offline (wls9.1)
    once I set a couple of parameters I invoke the writeDomain() command to write the domain to directory i get this
    command:
    newDomain=domainDirectory+'/'+domainName
    writeTemplate(newTemplate)
    writeDomain(newDomain)
    error:
    Error: writeDomain() failed. Do dumpStack() to see details
    begining of dumpstack()
    com.bea.plateng.domain.script.jython.WLSTException: com.bea.plateng.domain.script.ScriptException:
    om.bea.plateng.domain.GenerationException: Error <u>creating JarHelper</u>
    Root Cause: java.io.FileNotFoundException: D:\bea91\_configtmp\_bea5226tmp
    at com.bea.plateng.domain.script.jython.CommandExceptionHandler.handleException(CommandExce
    tionHandler.java:51)
    at com.bea.plateng.domain.script.jython.WLScriptContext.handleException(WLScriptContext.jav
    :1333)
    at com.bea.plateng.domain.script.jython.WLScriptContext.writeDomain(WLScriptContext.java:70
    at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)
    java.lang.Object;(Unknown Source).....
    I don't understand the error
    Ashanty
    Message was edited by:
    Ashanty

  • Using Ant to execute WLST setAppMetadataRepository command

    I am having a problem using Ant to execute the setAppMetadataRepository WLST command. This command puts an entry in adf-config.xml that points to the MDS datasource.
    This is the ant task that I'm using. These commands work from the WLST tool, but when using them with Ant, I get the error below.
       <target name="setAppMetadataRepositoryUsingWlst">
          <wlst debug="true" failonerror="true">
             <script>
                archive = getMDSArchiveConfig(fromLocation='C:/ADE/michande_platSavedSearch/commsplatform/ri/dist/comms-ri.ear')
                archive.setAppMetadataRepository(repository='mds-commsRepository',partition='riPartition', type='DB', jndi='jdbc/mds/commsRepository')
                archive.save()
            </script>
          </wlst>
       </target>Here is the error that I get (NameError: getMDSArchiveConfig). This is saying that getMDSArchiveConfig isn't a recognized command. Other commands (like connect(...)) work ok from ant, but not these MDS commands. Is this a bug or am I doing something wrong here?
    [wlst] <WLSTTask> All lines will be trimmed by 12
    [wlst] <WLSTTask> Line: archive = getMDSArchiveConfig(fromLocation='C:/ADE/michande_platSavedSearch/commsplatform/ri/dist/comms-ri.ear'). Final trim length: 12, String length: 124
    [wlst] <WLSTTask> Line: archive.setAppMetadataRepository(repository='mds-commsRepository',partition='riPartition', type='DB', jndi='jdbc/mds/commsRepository') . Final trim length: 12,
    String length: 147
    [wlst] <WLSTTask> Line: archive.save(). Final trim length: 12, String length: 26
    [wlst] <WLSTTask> The script that will be executed
    [wlst] archive = getMDSArchiveConfig(fromLocation='C:/ADE/michande_platSavedSearch/commsplatform/ri/dist/comms-ri.ear')
    [wlst] archive.setAppMetadataRepository(repository='mds-commsRepository',partition='riPartition', type='DB', jndi='jdbc/mds/commsRepository')
    [wlst] archive.save()
    [wlst]
    [wlst] Error: Error executing the script snippet
    [wlst] archive = getMDSArchiveConfig(fromLocation='C:/ADE/michande_platSavedSearch/commsplatform/ri/dist/comms-ri.ear')
    [wlst] archive.setAppMetadataRepository(repository='mds-commsRepository',partition='riPartition', type='DB', jndi='jdbc/mds/commsRepository')
    [wlst] archive.save()
    [wlst]
    [wlst] due to:
    [wlst] Traceback (innermost last):
    [wlst] File "<string>", line 1, in ?
    {color:red} [wlst] NameError: getMDSArchiveConfig{color}
    Thanks,
    Mike

    Not all WLST installations are equivalent. Have a read of [http://www.oracle.com/technetwork/articles/adf/part10-085778.html]this, specifically the paragraph right after Figure 13 for something to try. Bottom line - the WLST that comes with the base WLS server install cannot do the MDS operations.
    John

  • WLST redirect command does not log print messages

    I am using redirect to log WLST messages in a logfile, while my WLST Jython script is running. However, I am using the print command to output various messages, but I am finding that these print messages are not in the logfile.
    How do I get such messages in the "redirect logfile" ?

    Hi, I have a similar situation.
    I am exec the WLST code from within an application.
    When using the WLST scripting, and trying to use the "print" statement for logging messages, we can see the message on the console, but the messages do not show up in our logfile (using java.util.logging.Logger).
    For example, if my script has: print "test message"
    This will apppear on the console output, but not in my logfile.
    But other messages derived from the script are logged.
    For example, if in the WLST script we call startEdit(), then the message "Starting an edit session..." will appear in both the console and logfile as expected.
    Not sure why the print statement will not get directed to the logfile. Have tried both using statements in single quotes and double quotes, but it doesn't seem to make a difference.
    Any idea how we can log from WLST to ensure our logs capture all messages?
    I don't want to explicitly open the logfile as shown in your example, as its already open by the logger.

  • Wlst sh command line

    hi there,
    is it a known issue that the wlst.sh delivered with weblogic 10.3.0 (jdeveloper 11.1.1.0.2) is using a command like
    java ... weblogic.WLST $*
    to start the actual wlst/jython process, which makes it impossible to use wlst.sh with parameter names containing spaces, e.g. "wlst.sh script.py -o 'output file with spaces'"?
    to me it would have seemed more appropriate to write "$@" (including the double quotes) instead of $*.
    cheers,
    Matt

    In 10.3.2, the wlst.sh was changed to be
    eval '"${JAVA_HOME}/bin/java"' ${JVM_ARGS} weblogic.WLST '"$@"'

  • Non existent WLST configToScript command on WL 8.1 SP5 Solaris

    I was trying out WLST on a WL 8.1 SP5 Solaris and I noticed that the configToScript does not seem to exist, does some one now if this shouldnt be in the package allready?
    I needed this one in order to "clone" domains...
    Thank you for any responses,
    Jose

    Hi, I toke care regarding the case-sensitiveness but it seems not to be the issue, bellow I show my settings and it seems the command does not even appear on the help listing for the information category...
    root@zhcpbigs00<!>echo $CLASSPATH
    :/opt/bea/8.1_SP5/jdk142_08/lib/tools.jar:/opt/bea/8.1_SP5/patches:/opt/bea/8.1_SP5/patches/CR225812_81sp5.jar:/opt/bea/8.1_SP5/patches/CR238192_81sp5.jar:/opt/bea/8.1_SP5/patches/CR240904_81sp5.jar:/opt/bea/8.1_SP5/patches/CR241234_810sp5.jar:/opt/bea/8.1_SP5/patches/CR243498_810sp5.jar:/opt/bea/8.1_SP5/patches/CR247655_810sp5.jar:/opt/bea/8.1_SP5/patches/CR265510_810sp5.jar:/opt/bea/8.1_SP5/weblogic81/server/lib/weblogic_sp.jar:/opt/bea/8.1_SP5/weblogic81/server/lib/weblogic.jar:/opt/bea/8.1_SP5/weblogic81/common/lib/3rdparty.jar:/opt/bea/8.1_SP5/weblogic81/common/lib/comdev.jar:/opt/bea/8.1_SP5/weblogic81/common/lib/config.jar:/opt/bea/8.1_SP5/weblogic81/common/lib/jython.jar:
    root@zhcpbigs00<!>pwd
    /export/opt/bea/8.1_SP5
    root@zhcpbigs00<!>/export/opt/bea/8.1_SP5/jdk142_08/bin/java com.bea.plateng.domain.script.jython.WLST_offline
    Welcome to Weblogic Scripting Shell
    wls_offline:/>help()
    WLST is a command line scripting tool. Try:
    help('control') Lists the control functions available
    help('browse') Lists the browse functions available
    help('edit') Lists the edit functions available
    help('information') Lists the information functions available
    help('variables') Lists the variables available
    wls_offline:/>help("information")
    dumpStack:
    Prints the stack trace from the exception that might have thrown while executing a command.
    dumpVariables:
    Prints all the variables and their values.
    help:
    Display help about all the primitives and variables that are supported by WLST.
    ls:
    Displays and returns the list of all configuration objects and their attributes contained in current configuration node.
    prompt:
    Changes the display prompt to 'wls_offline:/>' if the prompt is not hidden and back to the long form if hidden.
    pwd:
    Prints the user's present hiearchy in the config tree.
    startRecording:
    Records all the user interactions with WLST. This will be useful inorder to replay any commands if you choose to.
    stopRecording:
    Stops all the recording of user actions.
    wls_offline:/>readDomain("/export/opt/bea/8.1_SP5/user_projects/domains/anyolddomain/")
    wls_offline:/anyolddomain>configToScript("/export/opt/bea/8.1_SP5/user_projects/domains/anyolddomain/","/home/mine/")
    Traceback (innermost last):
    File "<input>", line 1, in ?
    NameError: configToScript
    wls_offline:/anyolddomain>
    Thank you,
    Jose

  • Calling custom wlst command in embedded mode

    Hi,
    Please give any idea how to call custom wlst command (Oracle Access Manager related wlst command) in embedded mode.
    can we call /Oracle_IAM/common/bin/wlst.sh using java weblogic.WLST ?
    thanks

    thanks for quick reply
    i have to write a script which will register a OAM agent and create OAM Server (OAM related WLST custom command), all command comes under Fusinn Middleware product and for executing that command we have to run the wlst.sh file from <Oracle_Common>/common/bin, here if i run help('oam') command it shows all oam related command but when i run the wlst using java weblogic.WLST then it does not show any oam command because this call wlst from /WL_Home/common/bin, so i want to call that custom oam related wlst command by using java weblogic.WLST so that i can call my .py script as java weblogic.WLST *.py or in java class using WLSTInterpreter.

  • Problem with  listWebServices() command in wlst.

    Hi I am trying to get the list of webservices deployed on my weblogic domain, but when i execute the command i get no output, can any one please explain the reason for this.
    Regards
    rahul

    What do you mean by no output?
    You do not see any errors?
    Because listWebServices() is a custom WLST command and would need a specific jar in the classpath (For more information review the following doc: http://docs.oracle.com/cd/E25178_01/web.1111/e13813/custom_webservices.htm ). If this jar is missing an NameNotFound error would be thrown anyways.
    If you do not see any errors and just getting an empty output, then please consider checking that the web services applications deployed on the server are in ACTIVE state.
    Also, one more important check is that this command needs to be executed after the connect() command, i.e., it is a WLST online command, so you should be connected to the admin server.
    Arun

  • WLST setting domain name and ListenAddress attribute

    using weblogic 9.2
    just getting started with WLST and ran into two issues:
    1) want to state the ListenAddress for both the adminserver and application servers with the script below:
    cd('Servers/AdminServer')
    set('Name', 'adminserver')
    set('ListenAddress', 'localhost')
    set('ListenPort', 7001)
    cd('/')
    create('appserver1', 'Server')
    cd('Server/appserver1')
    set('ListenAddress', 'localhost')
    set('ListenPort', 7003)
    ....however get the error "Property Listen address of Server appserver1 is invalid. The server has the same combination of listen address and (default) port as other server" which clearly isn't the case since the ports listed above are different.
    2) second issue is more of a complaint that the domain name is automatically derived from the domain directed in the writeDomain command. want to specify another domain name. is this possible?
    thanks / matthew

    Ok update changing the hostname in the field does NOT allow me to edit the .local part. In fact it converts Steve.mydomain.net.local to Steve-mydomain-net.local.
    But I got my windows workgroup changed and I am showing up with the correct workgroup name from my other servers.
    Also, lets say you only have a couple of computers on your home network right? So dedicated dns is kind of overkill especially when most of them are laptops rebooting all the time.
    Well, your mac os x box has a hosts file. /etc/hosts as in if you want to edit sudo vi /etc/hosts. So you keep the computers pretty much in sync from those files.
    I was afraid the information would not be persistent across a reboot. It was.
    So, two out of three ain't bad. I read in the server forum its a pain in the ***. I was almost thinking of doing the hostconfig trick but I saw an Apple bulletin saying do NOT do that.

  • WLST Offline and MailSession

    I've tried to run the following WLST/Jython code:
    cd('/')
    lyra_name = 'LyraMailSession'
    lyra = create(lyra_name,'MailSession')
    lyra.setJNDIName('bogus.jndi.name.email')
    cd('MailSession/' + lyra_name)
    set('Properties','mail.smtp.host=email.tromskraft.lan)
    cd('/')
    assign('MailSession', lyra_name, 'Target', 'cgServer')
    This fails with the following error:
    Error: assign() failed.
    [java] File "/home/tronda/projects/tromskraft/customerportal/devenv/portal/build/filtered.py", line 137, in ?
    [java] File "initWls.py", line 62, in assign
    [java] com.bea.plateng.domain.script.jython.WLSTException: com.bea.plateng.domain.script.ScriptException: Unable to find the specified application or service
    The environment:
    WebLogic Platform 8.1.5
    Using WebLogic's built in version of ANT to run the following task:
    <java classname="com.bea.plateng.domain.script.jython.WLST_offline"
    dir="${basedir}" fork="true"
    failonerror="true"
    classpathref="wlst.classpath"
    >
    <arg file="${build.dir}/filtered.py" />
    </java>
    This also happens when running outside ANT. Any ideas?
    Trond Andersen, Invenia AS, http://www.invenia.no

    Hi Trond,
    I don't have a solution to the underlying problem, but I have a workaround that might be useful for you (if you've not created one already)
    After the writeDomain command has been run, call the following jython code:
    import org.dom4j as dom
    def mailSessionsFix( domainName, clusterName ):
         configLocation = domainName + "\config.xml"
         reader = dom.io.SAXReader()
         document = reader.read( configLocation )          
         root = document.getRootElement()
         mailSessions = root.elements("MailSession")
         for mailSession in mailSessions:
              mailSession.addAttribute("Targets",clusterName)
         out = io.FileWriter( configLocation );
         document.write( out );
         out.close()
    (The indentation will need fixing)
    Hope this helps,
    Adam

  • Problem with WLST in weblogic application server 10.3 on solaris 10 x86

    Hi Friends, I installed Sun Solaris 10 on my desktop x86. I am able to install oracle weblogic application server 10.3.
    I created one domain and I am trying to start AdminServer on that using WLST command.
    Before that , I started the admin server from command as normal start ( nohup ./startWebLogic.sh &) and the server started perfectly alright. After that I was trying to open admin console in firefox browser. It was opening perfectly alright.
    Now I stopped the server and checked no processes which are related to weblogic were running , and then initialized the WLST environment using the script "wlst.sh" , which is at (in my system) /usr/bea/wlserver_10.3/common/bin/wlst.sh. Now the environment had been set and the WLST offline prompt came up.
    Now I used the below WLST scirpt command
    startServer('AdminServer','mydomain','t3://localhost:7001','weblogic','weblogic1');
    and the server started perfectly alright, now what I did was , I started admin console at FireFox browser , it prompted me to enter user name and password , I gave them , and once the login is done, then in my shell window , I am seeing error as
    **wls:/offline> WLST-WLS-1263965848154: <Jan 19, 2010 11:39:24 PM CST> <Error> <HTTP> <BEA-101017> <[ServletContext@28481438[app:consoleapp module:console path:/console spec-version:2.5]] Root cause of ServletException.**
    **WLST-WLS-1263965848154: java.lang.OutOfMemoryError: PermGen space**
    **WLST-WLS-1263965848154: at java.lang.ClassLoader.defineClass1(Native Method)**
    **WLST-WLS-1263965848154: at java.lang.ClassLoader.defineClass(ClassLoader.java:616)**
    **WLST-WLS-1263965848154: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)**
    **WLST-WLS-1263965848154: at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:344)**
    **WLST-WLS-1263965848154: at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:301)**
    **WLST-WLS-1263965848154: Truncated. see log file for complete stacktrace**
    **WLST-WLS-1263965848154: >**
    **WLST-WLS-1263965848154: <Jan 19, 2010 11:39:24 PM CST> <Error> <JMX> <BEA-149500> <An exception occurred while registering the MBean com.bea:Name=mydomain,Type=SNMPAgentRuntime.**
    **WLST-WLS-1263965848154: java.lang.OutOfMemoryError: PermGen space**
    **WLST-WLS-1263965848154: at java.lang.ClassLoader.defineClass1(Native Method)**
    **WLST-WLS-1263965848154: at java.lang.ClassLoader.defineClass(ClassLoader.java:616)**
    **WLST-WLS-1263965848154: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)**
    **WLST-WLS-1263965848154: at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)**
    **WLST-WLS-1263965848154: at java.net.URLClassLoader.access$000(URLClassLoader.java:56)**
    **WLST-WLS-1263965848154: Truncated. see log file for complete stacktrace**
    **WLST-WLS-1263965848154: >**
    **WLST-WLS-1263965848154: Exception in thread "[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'" java.lang.OutOfMemoryError: PermGen space**
    So I thought I have less memory consuming for this weblogic admin server and opened up ,
    _/usr/bea/wlserver_10.3/common/bin/commEnv.sh_
    and changed the memory arguments as
    Sun)
    JAVA_VM=-server
    MEM_ARGS="-Xms1024m -Xmx1024m -XX:MaxPermSize=1024m" <---- previously these were 32m and 200m and MaxPermSize
    and also in /usr/bea/wlserver10.3/common/bin/bin/setDomainEnv.sh_
    and in this file also I changed the memory arguments as
    *if [ "${JAVA_VENDOR}" = "Sun" ] ; then*
    *WLS_MEM_ARGS_64BIT="-Xms256m -Xmx512m"*
    *export WLS_MEM_ARGS_64BIT*
    *WLS_MEM_ARGS_32BIT="-Xms1024m -Xmx1024m"*
    *export WLS_MEM_ARGS_32BIT*
    and restarted the server using the WLST command and again tried to open the admin console on a browser, same error is showing.
    (1) Environment : Sun Solaris x86
    (2) JDK : sun jdk 1.6._17
    Please help me what I am doing wrong here and please let me know the solution.
    I was trying to install jrockit 1.6 on this since my OS is sun solaris X86 , there is no compatible jrockit version is not there.
    Thanks a lot
    Peter

    Hi Peter,
    As you have mentioned in your Post that
    MEM_ARGS="-Xms1024m -Xmx1024m -XX:MaxPermSize=1024m" <---- previously these were 32m and 200m and MaxPermSize
    The Setting you have provided is wrong ...that is the reason you are gettingjava.lang.OutOfMemoryError: PermGen space. There is a RRation between PermSize and the maximum Heap Size...
    Just a Bit Explaination:
    Formula:
    (OS Level)Process Size = Java Heap (+) Native Space (+) (2-3% OS related Memory)
    PermSize : It's a Netive Memory Area Outside of the Heap, Where ClassLoading kind of things happens. In an operating System like Windows Default Process Size is 2GB (2048MB) default (It doesnt matter How much RAM do u have 2GB or 4GB or more)...until we dont change it by setting OS level parameter to increase the process size..Usually in OS like Solaris/Linux we get 4GB process size as well.
    Now Lets take the default Process Size=2GB (Windows), Now As you have set the -Xmx512M, we can assume that rest of the memory 1536 Mb is available for Native codes.
    (ProcessSize - HeapSize) = Native (+) (2-3% OS related Memory)
    2048 MB - 512 MB = 1536 MB
    THUMB RULES:
    <h3><font color=red>
    MaxPermSize = (MaxHeapSize/3) ----Very Special Cases
    MaxPermSize = (MaxHeapSize/4) ----Recommended
    </font></h3>
    In your Case -Xmx (Max Heap Size) and -XX:MaxPermSize both were same ....That is the reason you are getting unexpected results. These should be in proper ration.
    What should be the exact setting of these parameters depends on the Environment /Applications etc...
    But Just try -Xmx1024m -Xms1024m -XX:MaxPermSize256m
    Another recommendation for fine tuning always keep (Xmx MaxHeapSize & Xms InitialHeapSize same).
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Wonders Are Here)
    Edited by: Jay SenSharma on Jan 20, 2010 5:33 PM

  • Problems with WLST embedded in java app.

    Hi,
    I have a problem with the WLST embedded in a java app.
    I want to programatically create or reconfigure a domain from a java application. Following is a simple example of what I want to do.
    import weblogic.management.scripting.utils.WLSTInterpreter;
    public class DomainTester {
      static WLSTInterpreter interpreter = new WLSTInterpreter();
      private void processDomain() {
        if(domainExists()) {
          System.out.println("Should now UPDATE the domain");
        } else {
          System.out.println("Should now CREATE the domain");
      private boolean domainExists() {
        try {
          interpreter.exec("readDomain('d:/myDomains/newDomain')");
          return true;
        }catch(Exception e) {
          return false;
    }The output of this should be one of two possibles.
    1. If the domain exists already it should output
    "Should now UPDATE the domain"
    2. If the domain does not exist it should output
    "Should now CREATE the domain"
    However, if the domain does not exist the output is always :
    Error: readDomain() failed. Do dumpStack() to see details.
    Should now UPDATE the domain
    It never returns false from the domainExists() method therefor always states that the exec() worked.
    It seams that the exec() method does not throw ANY exceptions from the WLST commands. The catch clause is never executed and the return value from domainExists() is always true.
    None of the VERY limited number of examples using embedded WLST in java has exception or error handling in so I need to know what is the policy to detect failures in a WLST command executed in java??? i.e. How does my java application know when a command succeeds or not??
    Regards
    Steve

    Hi,
    I did some creative wrapping for the WLSTInterpreter and I now have very good programatic access to the WLST python commands.
    I will put this on dev2dev somewhere and release it into the open source community.
    Don't know the best place to put it yet, so if anybody sees this and has any good ideas please feel free to pass them on.
    Here is the wrapper class. It can be used as a direct replacement for the weblogic WLSTInterpreter. As I can't overload the actual exec() calls because I want to return a String from this call I created an exec1(String command) that will return a String and throw my WLSTException which is a RuntimeException which you can handle if you like.
    It sets up stderr and stdout streams to interpret the results both from the Python interpreter level and at the JVM level where dumpStack() just seem to do a printStackTrace(). It also calls the dumpStack() command should the result contain this in its text. If either an exception is thrown from the lower level interpreter or dumpStack() is in the response I throw my WLSTException containing this information.
    package eu.medsea.WLST;
    import java.io.ByteArrayOutputStream;
    import java.io.PrintStream;
    import weblogic.management.scripting.utils.WLSTInterpreter;
    public class WLSTInterpreterWrapper extends WLSTInterpreter {
         // For interpreter stdErr and stdOut
         private ByteArrayOutputStream baosErr = new ByteArrayOutputStream();
         private ByteArrayOutputStream baosOut = new ByteArrayOutputStream();
         private PrintStream stdErr = new PrintStream(baosErr);
         private PrintStream stdOut = new PrintStream(baosOut);
         // For redirecting JVM stderr/stdout when calling dumpStack()
         static PrintStream errSaveStream = System.err;
         static PrintStream outSaveStream = System.out;
         public WLSTInterpreterWrapper() {
              setErr(stdErr);
              setOut(stdOut);
         // Wrapper function for the WLSTInterpreter.exec()
         // This will throw an Exception if a failure or exception occures in
         // The WLST command or if the response containes the dumpStack() command
         public String exec1(String command) {
              String output = null;
              try {
                   output = exec2(command);
              }catch(Exception e) {
                   try {
                        synchronized(this) {
                             stdErr.flush();
                             baosErr.reset();
                             e.printStackTrace(stdErr);
                             output = baosErr.toString();
                             baosErr.reset();
                   }catch(Exception ex) {
                        output = null;
                   if(output == null) {
                        throw new WLSTException(e);
                   if(!output.contains(" dumpStack() ")) {
                        // A real exception any way
                        throw new WLSTException(output);
              if (output.length() != 0) {
                   if(output.contains(" dumpStack() ")) {
                        // redirect the JVM stderr for the durration of this next call
                        synchronized(this) {
                             System.setErr(stdErr);
                             System.setOut(stdOut);
                             String _return = exec2("dumpStack()");
                             System.setErr(errSaveStream);
                             System.setOut(outSaveStream);
                             throw new WLSTException(_return);
              return stripCRLF(output);
         private String exec2(String command) {
              // Call down to the interpreter exec method
              exec(command);
              String err = baosErr.toString();
              String out = baosOut.toString();
              if(err.length() == 0 && out.length() == 0) {
                   return "";
              baosErr.reset();
              baosOut.reset();
              StringBuffer buf = new StringBuffer("");
              if (err.length() != 0) {
                   buf.append(err);
              if (out.length() != 0) {
                   buf.append(out);
              return buf.toString();
         // Utility to remove the end of line sequences from the result if any.
         // Many of the response are terminated with either \r or \n or both and
         // some responses can contain more than one of them i.e. \n\r\n
         private String stripCRLF(String line) {
              if(line == null || line.length() == 0) {
                   return line;
              int offset = line.length();          
              while(true && offset > 0) {
                   char c = line.charAt(offset-1);
                   // Check other EOL terminators here
                   if(c == '\r' || c == '\n') {
                        offset--;
                   } else {
                        break;
              return line.substring(0, offset);
    }Next here is the WLSTException class
    package eu.medsea.WLST;
    public class WLSTException extends RuntimeException {
         private static final long serialVersionUID = 1102103857178387601L;
         public WLSTException() {
              super();
         public WLSTException(String message) {
              super(message);
         public WLSTException(Throwable t) {
              super(t);
         public WLSTException(String s, Throwable t) {
              super(s, t);
    }And here is the start of a wrapper class for so that you can use the WLST commands directly. I will flesh this out later with proper var arg capabilities as well as create a whole Exception hierarchy that better suites the calls.
    package eu.medsea.WLST;
    // Provides methods for the WLSTInterpreter
    // just to make life a little easier.
    // Also provides access to the more generic exec(...) call
    public class WLSTCommands {
         public void cd(String path) {
              exec("cd('" + path + "')");
         public void edit() {
              exec("edit()");
         public void startEdit() {
              exec("startEdit()");
         public void save() {
              exec("save()");
         public void activate() {
              exec("activate(block='true')");
         public void updateDomain() {
              exec("updateDomain()");
         public String state(String serverName) {
              return exec("state('" + serverName + "')");
         public String ls(String dir) {
              return exec("ls('" + dir + "')");
         // The generic wrapper for the interpreter exec() call
         public String exec(String command) {
              return interpreter.exec1(command);
         private WLSTInterpreterWrapper interpreter = new WLSTInterpreterWrapper();
    }Lastly here is some example code using these classes:
    its using both the exec(...) and cd(...) wrapper commands from the WLSTCommand.class shown above.
        String machineName = ...; // get name from somewhere
        try {
         exec("machine=create('" + machineName + "','Machine')");
         cd("/Machines/" + machineName + "/NodeManager/" + machineName);
         exec("set('ListenAddress','10.42.60.232')");
         exec("set('ListenPort', 5557)");
        }catch(WLSTException e) {
            // Possibly the machine object already exists so
            // lets just try to look it up.
         exec("machine=lookup('" + machineName + "','Machine')");
    ...After this call a machine object is setup that can be allocated later like so:
         exec("set('Machine',machine)");Regards
    Steve

  • WLST : We face this issue on WLS 8.1, 9.2, 10.3

    Hi All,
    Unless I have a copy of the boot.properties file in the domain root directory I cannot get weblogic.WLST to "utilize" the boot.properties. I thought there was a java option I should be able to set to "point" WLST to the boot.properties in the servers/instance/security directory?
    we need to be able to check state of instances programmatically - we cannot use the admin console to do this. We prefer to use weblogic.Admin to do this because we can run the weblogic.Admin GETSTATE command against each individual instance (which I have not been able to do with weblogic.WLST - you have to run the weblogic.WLST state command only via the admin instance which if the admin instance is down you won't be able to tell the state of the other instances in the domain.
    I'm hoping that if we can find a way to "tell" webogic.WLST where the boot.properties file is located.
    Putting a copy of the boot.properties file in the domain root works fine - but I don't have to do this based on the documentation provided by Oracle.
    Any help is appreciated.

    Hi,
    It is better to create the "userConfig" file abd pass it to the WLST connect() function...
    How to create user Config file:
    BEA_HOME :- /usr/bea10mp1
    WL_HOME :- BEA_HOME/wlserver_10.0
    STEP-1) Go to WL_HOME/server/bin and set the environment by executing "setWLSEnv.sh".
    STEP-2) Then execute below command which generate "*userconfig*" and "*userkey*" files in the directory you had execute this command
    java weblogic.Admin -adminurl t3://adminserverl:port -username <adminusername> -password <adminpassword> -userconfigfile userconfig -userkeyfile userkey -STOREUSERCONFIG
    This command prompts for "Y" or "N", select "Y", then creates two files "userconfig" and "userkey"
    STEP-3) Validate above keys are correct, execute below command
    java weblogic.Admin -adminurl t3://adminserverl:port -userconfigfile userconfig -userkeyfile userkey -GETSTATE
    Above command should display "RUNNING".
    STEP-4) Now you can use the following link of connect() in your WLSt script...
    connect(userConfigFile='/usr/someLocation/userconfig',userKeyFile='/usr/someLocation/userkey',url='t3://localhost:7001')
    Why we need to create userConfig ...please see below...
    http://download-llnw.oracle.com/docs/cd/E12840_01/wls/docs103/config_scripting/reference.html#wp1049091
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Wonders Are Here)
    Edited by: Jay SenSharma on Feb 24, 2010 10:26 AM

  • WLST script to activate/decativate MDB in side an EAR file

    Hi
    we have an ear file deployed to a cluster and that ear file has got MDB s inside it.
    I need to disable and enable this MD while the EAR file is in active state.
    I am able to perform the task via console but I need to script it.
    the WLST recording of the actions shows nothing.
    and I am not able to browse through the deployment in the wlst interactive commands.
    any help?

    Hi,
    If you want to dynamicall make any Modifications in your Deployment Descriptors like "application.xml"..."weblogic.xml"...etc then you can use *"Plan.xml"* feature provided bu WebLogic....
    Example : http://jaysensharma.wordpress.com/2009/11/29/shared-library-with-plan-xml/
    Example : http://jaysensharma.wordpress.com/2009/12/16/updating-cookiename-using-plan-xml/
    Thanks
    Jay SenSharma

  • Can't figure out why I can't undeploy an application using WLST

    Hi,
    I have WebLogic 9.2.2 installed locally on my WinXP machine. I am running a WLST script (through Ant 1.6) to attempt to undeploy my application. This line
    undeploy("RoutingEngine (v1.0)")
    is causing this error,
    [wlst] Undeploying application RoutingEngine (v1.0) ...
    [wlst] <Mar 4, 2009 1:04:40 PM MST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, RoutingEngine (v1.0) [archive: null], to AdminServer .>
    [wlst] Failed to undeploy the application with status failed
    [wlst] Current Status of your Deployment:
    [wlst] Deployment command type: undeploy
    [wlst] Deployment State : failed
    [wlst] Deployment Message : weblogic.management.ManagementException: [Deployer:149001]No application named 'RoutingEngine (v1.0)' exists for operation undeploy
    If I log in to my WebLogic admin console under "Deployments", there is an application named "RoutingEngine (v1.0)" listed. Should I be naming this something else or referencing it under another name?
    Thanks, - Dave

    Hi, something similar has happened in an oracle weblogic 10.3.5, when i tried to delete an application deployed as library, the adminserver responded with error “[Deployer:149001]No application named ‘my-web-9(9.2.1)’ exists for operation undeploy”.
    I solved this problem, using weblogic.Deployer but specifying the appversion like this:
    java weblogic.Deployer -verbose -noexit -name my-web-9 -appversion 9.2.1 -adminurl t3://192.168.40.66:7000 -user weblogic -undeploy

Maybe you are looking for

  • A665 - S5183 - Question about the ending warranty

    Hello, I have a Satellite A665-S5183 with Intel SB Chipset SATA problem.  Of course laptop works fine, no performance problems... i'm not using e-sata port so nothing has happened. But it was left 4 days of laptop warranty and 4 days to return laptop

  • How to Create one more SOA-INFRA under the same domain in weblogic server

    Hi All, Can anybody can guide how to create one more soa-infra under the same domain. In order to maintain my composites to be deployed into different domains, I need to create one more soa-infra and deployed all the composites under that one. Please

  • IPod won't sync, and the contents have gone

    Can't update my iPod - message is that it is because all of the playlists on my iPod no longer exist. The songs, ratings, playlists, and so on are all safe in my library, but there is nothing left on my iPod and I can't load anything on it. Why doesn

  • GetGraphics() problem

    hello guys, I have some problem in Swing pl help, What i have to do is draw a image on the JFrame so this is what i did 1. created a class 2. created the JFrame 3. got the image using getImage() 4. tried drawing it using drawImage() but the image is

  • How to start SAPGUI at entry point to RFC for debugging (using JCO)?

    Hi, I am calling an RFC using JCO and trying to have the SAPGUI pop up at the entry point to the RFC for debugging.  But it is not working on Mac OS X. I activate the debug via    JCO.Client client = JCO.createClient(..);    client.setAbapDebug(true)