This discussion is archived
5 Replies Latest reply: Aug 1, 2013 9:42 AM by 26111982 RSS

WLST in embedded mode

26111982 Newbie
Currently Being Moderated

Hi,

 

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
    user364167 Newbie
    Currently Being Moderated

    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
    user364167 Newbie
    Currently Being Moderated

    Think I've figured it out, you must define weblogic.home to point to an valid home. I was using JDeveloper 11.1.1.6 to extract the jars from, but for a quick test pointed to a 11.1.1.7 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

    ./bin:

    ./lib:

    ./lib/jython.jar:

    ./lib/wlfullclient.jar:

    ./lib/com.oracle.cie.comdev_6.3.0.0.jar:

    ./lib/com.oracle.cie.config-wls_7.1.0.0.jar:

    ./lib/com.oracle.cie.config_7.1.0.0.jar:

    ./lib/com.bea.core.xml.xmlbeans_2.1.0.0_2-5-1.jar:

    ./lib/com.oracle.cie.config-wls-schema_10.3.4.0.jar:

    ./lib/com.oracle.cie.wizard_6.1.0.0.jar

    -Dprod.props.file=./lib/props.txt

    -Dbea.home=

    -Dweblogic.home=/Users/xxxxxx/Projects/WebLogicServer/

    com.testing.wlst.WLST

     

    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

    el01cn06-web08---SHUTDOWN

    el01cn06-web09---SHUTDOWN

    el01cn06-web10---SHUTDOWN

    el01cn06-web01---RUNNING

    el01cn06-web02---SHUTDOWN

    el01cn06-web03---SHUTDOWN

    el01cn06-web04---SHUTDOWN

    el01cn06-web05---SHUTDOWN

    el01cn06-web06---SHUTDOWN

    el01cn06-web07---SHUTDOWN

     

    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();

          buffer.append("connect('weblogic','NoneOfYourBiz','t3://el01cn06:7599')");

          interpreter.exec(buffer.toString());

       } 

       private static void status()

       {

          StringBuffer buffer = new StringBuffer();

          buffer.append("state('web-cluster','Cluster')");

          interpreter.exec(buffer.toString());

       }

       public static void main(String[] args)

       {

          connect();

          status();

       }

    }

  • 3. Re: WLST in embedded mode
    26111982 Newbie
    Currently Being Moderated

    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
    user364167 Newbie
    Currently Being Moderated

    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
    26111982 Newbie
    Currently Being Moderated

    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.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points