Weblogic 12c dev install on Windows - MW_HOME issue
By Dmitry Nefedkin on Dec 27, 2011
I decided to install the Hudson on my laptop yesterday and picked new Weblogic 12c as a app server to host the Hudson war. I've downloaded WLS 12.1.1 Zip distribution for Mac OSX, Windows and Linux from here, and followed the install guidelines to create the domain. By the way, Maxence Button has shared his experience on that and actually I faced with the same issues. After that I just started domain with <DOMAIN_HOME>\startWebLogic.cmd and deployed hudson.war - pretty quick and easy.
But this morning when I issued <DOMAIN_HOME>\startWebLogic.cmd command for my 12c dev domain, the following error appeared:
starting weblogic with Java version:
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)
Starting WLS with line:
d:\dev\java\JDK16~1.0_2\bin\java -client -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=256m -Dweblogic.Name=myserver -Djava.security.policy=D:\wlserver\server\lib\weblogic.policy -Xverify:none -Djava.endorsed.dirs=d:\dev\java\JDK16~1.0_2/jre/lib/endorsed;D:\wlserver/endorsed -da -Dplatform.home=D:\wlserver -Dwls.home=D:\wlserver\server -Dweblogic.home=D:\wlserver\server -Dweblogic.management.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= weblogic.Server
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Server
Caused by: java.lang.ClassNotFoundException: weblogic.Server
at java.security.AccessController.doPrivileged(Native Method)
Could not find the main class: weblogic.Server. Program will exit.
Please note D:\wlserver , that's the value of the %WL_HOME% variable and it's poining to the wrong directory, my WL_HOME should be d:\dev\Oracle\WLS1211Dev\wlserver ! So I started my investigation:
- <DOMAIN_HOME>\startWeblogic.cmd just calls <DOMAIN_HOME>\bin\startWeblogic.cmd . Nothing special
- <DOMAIN_HOME>\bin\startWeblogic.cmd calls setDomainEnv.cmd at its beginning
- setDomainEnv.cmd sets WL_HOME to correct value at the beginning of the script, and then calls %WL_HOME%\common\bin\commEnv.cmd in the middle of the script
- commEnv.cmd resets WL_HOME = %MW_HOME%\wlserver , but nobody have set MW_HOME before! Script assumes that MW_HOME have been set externally. I checked WLS 10.3.5, in that version MW_HOME have been set explicitly in commEnv.cmd
- setDomainEnv.cmd continue it's execution with the wrong value for the WL_HOME variable, and the result is ClassNotFound exception at the end of startWeblogic.cmd
So, what are the options to fix this:
- Set MW_HOME value in the Windows Environment variables dialog. I do not like this approach, because my laptop has many Oracle Middleware homes.
- Modify commEnv.cmd, change the line
set MW_HOME=<exact location of your WLS 12c Installation>
Not ideal, because you're modifying standard script, no one guarantee that cannot lead to some side effects
- create <DOMAIN_HOME>\customStartWeblogic.cmd script in the with the following commands:
@REM Change the next line according the location of your WLS 12c Installation
@REM Now execute the standard script
Well, that's what I did in my environment and it works pretty well.
Update (Dec, 29):
I've repeated the installation process one more time, logged all the install actions into THIS FILE, and the result was the same. I start thinking that's OS-related issue, because a lot of guys reported that everything went well on Mac OS X or Linux.