Resolved – java.lang.ClassNotFoundException: weblogic.WLST

If you working with Wlst scripts or you wrote some python script and when you try to run the scripts

you can faces this weird error-

Exception in thread “main” java.lang.NoClassDefFoundError: weblogic.WLST
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang.ClassNotFoundException: weblogic.WLST not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)

Cause – Reason can be weblogic.jar or jar which contains weblogic.WLST class is not set into classpath.you need to set the classpath

Solution– set the Weblogic environment which includes several environment variables including WL_HOME and JAVA_HOME among others. The best way to set these environment variable is to source the script $MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh

and go to $MW_HOME/user_project/domain/base_domain/bin/setDomainEnv.sh

You need to execute both the command and please note try to run command in unix like dot space and then command like below

$MW_HOME/wlserver_10.3/server/bin/ . ./setDomainEnv.sh
$MW_HOME/user_project/domain/base_domain/bin/ . ./setDomainEnv.sh

Happy weblogic learning with Vinay Kumar

Vinay

I am an Oracle ACE in Oracle ADF/Webcenter. Sr Java Consultant-working on Java/J2EE/Oracle ADF/Webcenter Portal/ content and Hibernate for several years. I'm an active member of the OTN JDeveloper/Webcenter forum. Passionate about learning new technologies. I am here to share my knowledge. Give your views and suggestion on [email protected] .

More Posts - Website

Follow Me:
TwitterLinkedInGoogle PlusYouTube