3 Replies Latest reply: Mar 22, 2012 9:18 AM by discharge RSS

    How to create standalone lightweight WLST client ?

      Recently I was trying to figure out on how to run WLST scripts at remote weblogic instances, and after making a quick research I've discovered that all old approaches intendedd for weblogic 9.x such as adding weblogic.jar into classpath, then running script with this simple command are not working anymore:

      When i use weblogic.jar from 10.3 server version I get Classnotfound error:
      *C:\TEMP>java -cp ./weblogic.jar weblogic.WLST ./createusers.py username weblogic password weblogic1 --url t3://localhost:7001*
      Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/descriptor/DescriptorClassLoader
      at weblogic.WLST.main(WLST.java:19)
      Caused by: java.lang.ClassNotFoundException: weblogic.descriptor.DescriptorClassLoader
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      *... 1 more*

      Additionally I've tried to resolve situation with create & adding to the classpath so called Weblogic full client, I've created it at weblogic appserver as explaiined in docs, then copied to the client machine.
      cd wlserver_10.3\server\lib
      java -jar wljarbuilder.jar

      I've got pretty bulky JAR with 57Lb in size.

      With this JAR in classpath now I hit another error about missing weblogic home.
      *C:\TEMP>java -cp ./weblogic.jar;./wlfullclient.jar weblogic.WLST ./createusers.py username weblogic password weblogic1 --url t3://localhost:7001*

      Initializing WebLogic Scripting Tool (WLST) ...

      Problem invoking WLST - java.lang.RuntimeException: error in finding weblogic.Home

      So, with all these faults, is there any way available for weblogic 10.3 users to have standalone and portable WLST client just for running scripts ?
      I definitely do not want to install a whole appserver with all the bunch of libraries & stuff just for running scripts.
        • 1. Re: How to create standalone lightweight WLST client ?
          Will Lyons-Oracle
          Unfortunately there is not a WLST client at this time. An option would be to use a "core application server" only installation (a custom installation option that installs the essential server runtime components).
          • 2. Re: How to create standalone lightweight WLST client ?
            Uh-oh. So here we go again with manual client creation out of slow & painful search for relevant classes & depencies then.
            Thanks for confirming my doubts.
            So far i've just found that upon initializing stage WLST interpreter is using weblogic.home as a reference point and if I set it up at my location where weblogic.jar and wlfullclient.jar are present it just pots out with meaningless message:
            Initializing WebLogic Scripting Tool (WLST) ...

            Problem invoking WLST - java.lang.NullPointerException
            at weblogic.management.utils.PDevHelper.getUpgradeLaunchLocation(PDevHelper.java:70)
            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.WLST.main(WLST.java:83)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at weblogic.WLST.main(WLST.java:29)
            • 3. Re: How to create standalone lightweight WLST client ?
              I've succesfully created one after just one hour of digging with default installation of weblogic 10.3 on M$ Windows VM:
              Here goes short instruction on how to create it by yourself.

              How to create the standalone WLST client from default weblogic server installation in three easy steps:

              1. Create so called "weblogic full client", for this run the following commands:
              SET WL_HOME=C:\app\oracle\wlserver_10.3
              CALL "%WL_HOME%\server\bin\setWLSEnv.cmd"
              java -jar wljarbuilder.jar -profile wlfullclient
              You will get single archive named wlfullclient.jar
              Copy this jar into the folder of your choice, let's call it /tmp/lib

              2. Copy into the same folder the following files from weblogic server installation:

              3. Create empty text file props.txt and put into the same folder /tmp/lib

              That's it, now you have all nessary libs & files.
              Now, you can run WLST client with your scripts from this temp folder with the following simple command line:

              java -cp <PUT_ALL_LIBS_INTO_CLASSPATH_HERE> -Dprod.props.file=./props.txt -Dbea.home= -Dweblogic.Home= weblogic.WLST <PUT_COMMANDS_FOR_YOUR_SCRIPTS_HERE>

              This client will be working without any installation or setup, just copy these libs into location you need.
              Additionally for higher portability you may merge all the jars above into one, like I did, the resulting file will be about 71 Mb in size.
              Practically the client size can be scaled down to 3Mb, but I'm too lazy to do more research on this.