How can I create a portable Weblogic Scripting Tool application?

我们两清 提交于 2019-12-08 02:28:53

问题


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?


回答1:


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.



回答2:


my list of libraries needed is following:

coherence.jar
com.bea.core.xml.xmlbeans.jar
com.oracle.cie.comdev_7.7.0.0.jar
com.oracle.cie.config_8.4.0.0.jar
com.oracle.cie.config-external_8.4.0.0.jar
com.oracle.cie.config-owsm_8.4.0.0.jar
com.oracle.cie.config-security_8.4.0.0.jar
com.oracle.cie.config-wls_8.4.0.0.jar
com.oracle.cie.config-wls-external_8.4.0.0.jar
com.oracle.cie.config-wls-schema_8.4.0.0.jar
com.oracle.cie.dependency_1.7.0.0.jar
com.oracle.cie.encryption_2.4.0.0.jar
com.oracle.cie.service-table_1.4.0.0.jar
com.oracle.cie.wizard_7.7.0.0.jar
com.oracle.core.weblogic.msgcat.jar
com.oracle.glcm.common-logging_1.5.0.0.jar
com.oracle.glcm.encryption_2.6.0.0.jar
com.oracle.weblogic.lifecycle.provisioning.api.jar
com.oracle.weblogic.lifecycle.provisioning.core.jar
com.oracle.weblogic.lifecycle.provisioning.wlst.jar
cryptoj.jar
jython-modules.jar
weblogic.jar
wlfullclient.jar
wls-api.jar
wlst-impl.jar

I used jarscan utility to locate all missing classes by trying to run several wlst scripts. Total size is cca 150MB

My launch.sh is following:

#!/bin/bash
MYDIR=$(dirname $0)
CP=$(echo $MYDIR/lib/*.jar | tr ' ' ':')
echo $CP
java -cp $CP -Dprod.props.file=$MYDIR/props.txt -Dbea.home=`pwd` -Dweblogic.home=`pwd` weblogic.WLST $@

Not perfect, but working for me.




回答3:


I made a script to retrieve all the required files for a Standalone WLST tool

The repository is https://github.com/cheloide/wlst-standalone

The script extracts and install Weblogic Server in a temporary location, creates wlfullclient.jar and then copies the required resources to a directory of your choosing or the working path

I also made another script in the same repo to use the Weblogic.Deployer tool

Currently the tool only works with GNU/Linux; should work with Mac-OS with some tweaks.




回答4:


I recently faced the same issue on WLS 12.1.3 and ended up with a different set of dependent jars. Here's what I needed:

wlfullclient.jar
weblogic.jar
com.bea.core.xml.xmlbeans_1.0.0.0_2-6-0.jar
com.oracle.cie.comdev_7.1.0.0.jar
com.oracle.cie.config-owsm_8.1.0.0.jar
com.oracle.cie.config-security_8.1.0.0.jar
com.oracle.cie.config-wls-schema_12.1.3.0.jar
com.oracle.cie.config-wls_8.1.0.0.jar
com.oracle.cie.config_8.1.0.0.jar
com.oracle.cie.dependency_1.1.0.0.jar
com.oracle.cie.encryption_2.1.0.0.jar
com.oracle.cie.service-table_1.1.0.0.jar
com.oracle.cie.wizard_7.1.0.0.jar
com.oracle.core.weblogic.msgcat_3.0.0.0.jar
jython-modules.jar

This has been tested for start/stop server and undeploy/deploy application.



来源:https://stackoverflow.com/questions/11098841/how-can-i-create-a-portable-weblogic-scripting-tool-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!