3

I tried to run WLST (on Windows XP) but i always get java.lang.NoClassDefFoundError:

Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/wlst
Caused by: java.lang.ClassNotFoundException: weblogic.wlst
        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)
Could not find the main class: weblogic.wlst.  Program will exit.

I tried to run *user_projects/domains/my_domain/bin/setDomainEnv.cmd* and *wlserver_10.3/server/bin/setWLSEnv.cmd* but without any success, i always get this NoClassDefFoundError when i run java weblogic.wlst myscript.py. What should i do?

mykola
  • 1,736
  • 5
  • 25
  • 37

2 Answers2

6

To invoke WLST:

<WL_HOME>/common/bin/wlst.cmd myscript.py

Example:

C:/Oracle/Middleware/wlserver_10.3/common/bin/wlst.cmd myscript.py

The reason for your error is, weblogic.jar is not present in your CLASSPATH environment variable.

jpaugh
  • 6,634
  • 4
  • 38
  • 90
Mani
  • 965
  • 6
  • 10
  • 1
    Yeah, that was pretty easy! But why is it everywhere written that i should call */user_projects/domains/my_domain/bin/setDomainEnv.cmd* or *wlserver_10.3/server/bin/setWLSEnv.cmd* and then i can run "java welogic.wlst myscript.py"? – mykola Oct 24 '12 at 10:25
  • Along with setWLSEnv there could be other files also that need to be invoked. Basically wlst.cmd/sh will take care of setting all the environment settings required for WLST. – Mani Oct 29 '12 at 07:14
4

You don't need to do that every time you run the batch file.

  1. From "My Computer" or "Computer" (depending on your version of Windows)
  2. Click "Properties" or "System Properties"
  3. Click "Advanced System Settings"
  4. Add these user Environment Variables

    WL_HOME=C:/Oracle/Middleware/wlserver_10.3
    

    and

    CLASSPATH=.;%WL_HOME%/server/lib/weblogic.jar
    
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
PavanDevarakonda
  • 625
  • 5
  • 27
  • I found the python script demanded the server be located C:\Oracle\Middleware\Oracle_Home\wlserver. I renamed the directory, added the environment variables above and everything worked. – ggb667 Jan 31 '14 at 22:21