Exception in thread “main” java. lang. NoClassDefFoundError : weblogic/WLST

This is my first attempt with WLST (WebLogic Scripting Tool) which is scripting tool to create , manage and monitor webLogic domains, more information here .

.

You can invoke WLST by running  “java weblogic.WLST

I tried this on my WebLogic Server and straight hit error
_________

Exception in thread “main” java.lang.NoClassDefFoundError: weblogic/WLST
_________

I soon realised that jar file which contains class weblogic.WLST is missing from classpath and quick fix is to set environment variable using setWLSEnv.sh (under WL_HOME/server/bin) . For Fusion MiddleWare (FMW) 11g, it should be under $MW_HOME/ wlserver_10.3/ server/ bin


______
set environemnt variable for weblogic server
cd WL_HOME/server/bin
. ./setWLSEnv.sh
______

$ java weblogic.WLST

Initializing WebLogic Scripting Tool (WLST) …

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline>
__________

.
More on WLST commands coming in next posts but here are some WLST basics

.

1. WebLogic Scripting Tool (WLST) – is command line scripting tool to create , manage and monitor webLogic domains and resources/applications deployed on WebLogic

2. WLST is based on Jython based scripting language, which in turn is Java implementation of Python.

3. WLST is used
– To automate common tasks
– If administration console is not available or as alternative to Administration Console

4. WLST can be run in offline and online mode
a) online mode> interact with running weblogic server
b) offline mode> servers in domain should be shutdown and WLST updates directly config.xml on file system

5. If you do not supply any script file then WLST runs in interactive mode.
6.You can generate WLST scripts via WebLogic Console as well -> click on Record button on console after clicking ‘Lock and Edit’ button on change center. To end recording click on ‘Activate Changes’

.
wlst record

.

7. WLST communicates with Weblogic’s MBean to retrieve and update resources on a running server.

 

Learn Oracle Weblogic Server Administration

 

Get 100 USD OFF + 100% Money Back Guarantee

Click here to get Early Bird Discounts

About the Author Atul Kumar

Oracle ACE, Author, Speaker and Founder of K21 Technologies & K21 Academy : Specialising in Design, Implement, and Trainings.

follow me on:

Leave a Comment:

17 comments
andrew says November 30, 2009

Hi Atul,
so where is the jar file which contains class weblogic.WLST ?

Reply
Atul Kumar says December 1, 2009

@ Andrew,
Good question, welogic.WLST class is in jar file $WL_HOME/server/lib/weblogic.jar

Reply
purna chandra says November 22, 2010

Hi

For this exception we just need to set the classpath : C:\bea\wlserver_10.3\server\lib\weblogic.jar;

and path : C:\bea\wlserver_10.3\server\bin\setWLSEnv.cmd;

Thanks
Purna Chandra

Reply
test says August 19, 2011

how to set classpath and where to set classpath

Reply
Atul Kumar says August 25, 2011

@ test,
To set classpath on unix

export CLASSPATH=:$CLASSPATH

for windows
set CLASSPATH=:$CLASSPATH

Where to set classpath?

It depends on what and how you run application which uses this classpath.

Reply
@Tech says September 21, 2011

Hi,

I have set path as said above but why always need to run (. ./setWLSEnv.sh) before use it or ot should be set in setDomainEnv.sh.

Thanks
@Tech

Reply
ankam says February 3, 2012

Hi,

For this exception we need to add the weblogic.jar to classpath
you can see the same by executing the command ENV on unix machine.
Once it is added to CLASSPATH then execute the java weblogic.WLST then your WLST will be initiate.

Weblogic_Home u will find one .profile there u can maintain all the env&CLASSPATH details.

Reply
Thirunavukkarasu says March 28, 2012

Hi,

I set the environment using ./setWLSEnv.sh. I also checked the CLASSPATH variable,it’s having the needed JAR file:
“/opt/grd/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:”.

But still i’m unable to resolve the issue.Error message:
[grd@cvgrhegrdt003 bin]$ java weblogic.WLST
Exception in thread “main” java.lang.NoClassDefFoundError: weblogic/WLST
Caused by: java.lang.ClassNotFoundException: weblogic.WLST
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: weblogic.WLST. Program will exit.

Reply
Atul Kumar says March 28, 2012

@ Thirunavukkarasu,

1. Which version of Java you are using ?

which java
java -version

2. What is WebLogic Version and & Operating System version ?

Reply
Thirunavukkarasu says March 28, 2012

1.java version “1.6.0_26”
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

2. weblogic 10.3,GNU/Linux

Reply
Thirunavukkarasu says March 28, 2012

Hi Atul,

I need to change the mode from Interactive mode(java WLST) to Scripting Mode(java
-Dweblogic.security.SSL.ignoreHostnameVerification=true
-Dweblogic.security.TrustKeyStore=DemoTrust ]
weblogic.WLST)?

Reply
Jitendra says October 16, 2012

Thanks…..

Reply
Anwar Hussain says October 25, 2012

When startin Managed server, am getting this error message

[oracle@hostname bin]$

Kindly Help me

Reply
    Atul Kumar says October 25, 2012

    @ Anwar Hussain,
    Paste the error message (remove < > from logs )

    Reply
ankumar1974 says November 23, 2012

Hi Atulkumar,

I am trying to invoke WLST script to create the domain using CYGWIN which in turn connects to the windows machine however it is failing with the below exception

Exception in thread “main” java. lang. NoClassDefFoundError : weblogic/WLST

I have set the classpath to weblogic.jar but it fails. Please let me know how we can set the classpath in CYGWIN in order to invoke WLST Script.

I was trying to do as below using cygwin.

java weblogic.WLST createdomain.py

Looking forward for your response.

Thanks
ankumar

Reply
gravik says November 25, 2014

thanks a lot, it worked for me..

Reply
Marin says September 9, 2016

Que tal, estoy haciendo un aplicación en java, pero necesito entrar a wlst solo que aunque he agregado las .jar correspondientes me manda el error,
Exception in thread “main” java.lang.RuntimeException: Could not find the OffLine WLST class
at weblogic.management.scripting.utils.WLSTUtil.getOfflineWLSTScriptPathInternal(WLSTUtil.java:88)
at weblogic.management.scripting.utils.WLSTUtil.setupOfflineInternal(WLSTUtil.java:255)
at weblogic.management.scripting.utils.WLSTUtil.setupOffline(WLSTUtil.java:234)
at weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:134)
at weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:76)
at project1.EnbeddedWLST.(EnbeddedWLST.java:17)
at project1.EnbeddedWLST.main(EnbeddedWLST.java:51)
Caused by: java.lang.ClassNotFoundException: com.oracle.cie.domain.script.jython.WLST_offline
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at weblogic.management.scripting.utils.WLSTUtil.getOfflineWLSTScriptPathInternal(WLSTUtil.java:81)
… 6 more

He estado investigando pero no encuentro resultado.
agradecería su ayuda.

Reply
Add Your Reply

Not found