Search code examples
javaweblogicwlst

How can I create a portable Weblogic Scripting Tool application?


I am creating WLST scripts which will be run against a server running weblogic which is fairly locked down. I only have permission to view logs and read only access to the console unless a pre-authorised change. I don't have permission to access the entire weblogic domain and run WLST.

I would like to run WLST on a differernt server which has Java installed but not Weblogic.

I was initially hoping to add a weblogic jar to the classpath then run the tool but it seems a bit more complicated that that.

I have been following these instructions without success.

My current setup is this directory structure with jars taken from weblogic 12.1.1:

├── launch.sh
├── lib
│   ├── com.bea.core.utils.full_2.0.0.0.jar
│   ├── com.bea.core.xml.xmlbeans_2.2.0.0.jar
│   ├── com.oracle.cie.comdev_6.4.0.0.jar
│   ├── com.oracle.cie.config_7.2.0.0.jar
│   ├── com.oracle.cie.config-wls_7.2.0.0.jar
│   ├── com.oracle.cie.config-wls-schema_10.3.6.0.jar
│   ├── com.oracle.cie.wizard_6.1.0.0.jar
│   ├── com.oracle.core.weblogic.msgcat_1.3.0.0.jar
│   ├── jython.jar
│   ├── weblogic.jar
│   ├── weblogic.server.modules.jsf2.0_12.1.1.0.jar
│   ├── wlclient.jar
│   ├── wlfullclient.jar
│   └── wlthint3client.jar
└── props.txt

props.txt is empty described on the Oracle forum and launch.sh contains:

java -cp $(echo lib/*.jar | tr ' ' ':') -Dprod.props.file=props.txt -Dbea.home= -Dweblogic.home= weblogic.WLST 

on running launch.sh, i get the error:

sam@ubuntu64vm:~/Desktop/scripts$ ./launch.sh

Initializing WebLogic Scripting Tool (WLST) ...

Problem invoking WLST - java.lang.NullPointerException

Is it possible to create a minimal / portable WLST application?


Solution

  • Standalone WSLT works for Weblogic 10.3.4 by running the following command (see Note 3, this stopped the java.lang.NullPointerException):

    java -cp lib/wlfullclient.jar;lib/com.bea.core.xml.xmlbeans_2.2.0.0.jar;lib/com.oracle.cie.comdev_6.3.0.0.jar;lib/com.oracle.cie.config-wls-schema_10.3.4.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.oracle.cie.wizard_6.1.0.0.jar;lib/com.oracle.core.weblogic.msgcat_1.1.0.0.jar;lib/jython.jar;lib/weblogic.jar -Dprod.props.file=lib/props.txt -Dbea.home= -Dweblogic.home=c:/users/username/wls10 weblogic.WLST your-script.py
    

    Notes about script:

    1. My Example setup of WLST is run from c:/users/username/wls10
    2. The required jar are in c:/users/username/wls10/lib.
    3. The weblogic.home must be set to an absolute path e.g. c:/users/username/wls10'.
    4. You must create a blank props.txt in /lib directory.
    5. I also followed same instructions as above.