5 Replies Latest reply: Aug 1, 2013 11:42 AM by 26111982 RSS

    WLST in embedded mode




      I am trying to implement wlst in embedded mode to automate few setup creations in weblogic administration server.I have added the required jars in class path and tried to run the code.But the WLSTInterprester failed to instantiate and threw below excpetion:


      Exception in thread "main" java.lang.NullPointerException

        at java.io.File.<init>(Unknown Source)

        at weblogic.management.utils.PDevHelper.getUpgradeLaunchLocation(PDevHelper.java:77)

        at weblogic.management.utils.PDevHelper.getPDevClassLoader(PDevHelper.java:36)

        at weblogic.management.scripting.utils.WLSTUtil.setupOffline(WLSTUtil.java:226)

        at weblogic.management.scripting.utils.WLSTInterpreter.<init>(WLSTInterpreter.java:134)

        at weblogic.management.scripting.utils.WLSTInterpreter.<init>(WLSTInterpreter.java:76)

        at com.ncr.main.EmbeddedWLST.<init>(EmbeddedWLST.java:11)

        at com.ncr.main.EmbeddedWLST.main(EmbeddedWLST.java:27)


      Please help me  in resolving this issue.


      Thanks in advance

        • 1. Re: WLST in embedded mode

          Same problem here! If you figure a solution before I do, please post it here, I'll do likewise

          • 2. Re: WLST in embedded mode

            Think I've figured it out, you must define weblogic.home to point to an valid home. I was using JDeveloper to extract the jars from, but for a quick test pointed to a WLS home and it worked. This got me past the NullPointerException,  I just kept adding jars to fix the ClassDefNotFound exceptions till it ran clean; so this is the minimal set that ran my script


            This is my java command line (obviously broken down for readability).


            java -cp
















            This was the output


            Connecting to t3://el01cn06:7599 with userid weblogic ...

            Successfully connected to Admin Server 'AdminServer' that belongs to domain 'dev-web'.


            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.


            There are 10 server(s) in cluster: web-cluster


            States of the servers are












            This is my embedded WLST class (hacked from an example I found via the Google Institute Of Technology)


            package com.testing.wlst;

            import java.util.*;

            import weblogic.management.scripting.utils.WLSTInterpreter;

            import org.python.util.InteractiveInterpreter;


            public class WLST


               static InteractiveInterpreter interpreter = new WLSTInterpreter();


               private static void connect()


                  StringBuffer buffer = new StringBuffer();




               private static void status()


                  StringBuffer buffer = new StringBuffer();




               public static void main(String[] args)






            • 3. Re: WLST in embedded mode

              Thanks a lot.This is really helpful and worked for me.


              So here one another question I have; we are specifying the weblogic home while trying to execute it.So does that mean having a weblogic installation is mandatory in the server where this client is run.I am actually trying to  monitor a weblogic server from a remote server where the weblogic installation is not present.

              • 4. Re: WLST in embedded mode

                I honestly dont know. I was trying to create a Java Wrapper around WLST so I could use JPype to bridge it to a normal python script. the Idea being to instantiate the JVM once and feed it commands for automated deployment. I'd just started playing with it the day before (the day of your original post) and hit the same problem you did. A lot of posts show -Dweblogic.home= on the command line but one showed it being set. I thought what the heck and just tried it since I had a weblogic install on my laptop. Since I couldnt get JPype to work for me I'm looking at alternatives.


                One thing though, although I had a weblogic install it wasnt running, just taking up disk space.


                Hope that helps

                • 5. Re: WLST in embedded mode

                  Okay Thanks a lot for the reply..

                  Actually I am also in the starting phase with WLST. I hope further research on it may clear my doubts.

                  I have also seen the weblogic home setting in many documents and I was trying to run the java class from Eclipse and actually I have set it as classpath param.But it didn't work as expected and threw the error I have posted.Today I have tried by running the command you have mentioned and it worked like charm.Still I couldn't run successfully from Eclipse.


                  Thanks for all help.I will post in this thread if I get to know about it.