Unrecognized option: -jrockit Error: Could not create the Java Virtual Machine.


Unrecognized option: -jrockit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit


是weblogic 10.3.5 启动的时候抛出的一个错误


weblogic安装时选择的是开发模式,选用的jdk是jdk1.7,domain域创建的时候选择的jdk也是jdk1.7


在 %DOMAIN_HOME%\bin\startWebLogic.cmd 启动时出现的错误

具体错误信息为

starting weblogic with Java version:
Unrecognized option: -jrockit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Starting WLS with line:
D:\DEV_ENV\Java7\JDK17~1.0_6\bin\java -jrockit   -Xms512m -Xmx512m -Dweblogic.Na
me=AdminServer -Djava.security.policy=D:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\w
eblogic.policy  -Xverify:none  -da -Dplatform.home=D:\Oracle\MIDDLE~1\WLSERV~1.3
 -Dwls.home=D:\Oracle\MIDDLE~1\WLSERV~1.3\server -Dweblogic.home=D:\Oracle\MIDDL
E~1\WLSERV~1.3\server   -Dweblogic.management.discover=true  -Dwlw.iterativeDev=
 -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=D:\Oracle\MIDD
LE~1\patch_wls1035\profiles\default\sysext_manifest_classpath;D:\Oracle\MIDDLE~1
\patch_ocp360\profiles\default\sysext_manifest_classpath  weblogic.Server
Unrecognized option: -jrockit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

D:\Oracle\Middleware\user_projects\domains\dev_domain\bin>

出错地
Unrecognized option: -jrockit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exi

跟着错误找原因,第一处的错误的上面一行输出信息为

starting weblogic with Java version:

找到该行的脚本内容

echo starting weblogic with Java version:

%JAVA_HOME%\bin\java %JAVA_VM% -version

if "%WLS_REDIRECT_LOG%"=="" (
	echo Starting WLS with line:
	
	echo %JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
	%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
) else (
	echo Redirecting output from WLS window to %WLS_REDIRECT_LOG%
	%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%  >"%WLS_REDIRECT_LOG%" 2>&1 
)


分析了下,怀疑是 %JAVA_VM%参数的问题


试着将脚本修改为

echo starting weblogic with Java version:
echo %JAVA_VM%
%JAVA_HOME%\bin\java %JAVA_VM% -version

if "%WLS_REDIRECT_LOG%"=="" (
	echo Starting WLS with line:
	
	echo %JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
	%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
) else (
	echo Redirecting output from WLS window to %WLS_REDIRECT_LOG%
	%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%  >"%WLS_REDIRECT_LOG%" 2>&1 
)

再启动,检验下 %JAVA_VM% 的参数内容
starting weblogic with Java version:
-jrockit
Unrecognized option: -jrockit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit

证明, %JAVA_VM% 的内容是-jrockit,这是之前bea时候开发的一个jdk,现在用的是sun的jdk,这个参数不识别。

最简单的修改方式,把启动脚本中的 %JAVA_VM% 去掉就可以了


将脚本修改为

<pre name="code" class="html">echo starting weblogic with Java version:

%JAVA_HOME%\bin\java -version

if "%WLS_REDIRECT_LOG%"=="" (
	echo Starting WLS with line:
	
	echo %JAVA_HOME%\bin\java %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
	%JAVA_HOME%\bin\java %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%
) else (
	echo Redirecting output from WLS window to %WLS_REDIRECT_LOG%
	%JAVA_HOME%\bin\java %MEM_ARGS% -Dweblogic.Name=%SERVER_NAME% -Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %JAVA_OPTIONS% %PROXY_SETTINGS% %SERVER_CLASS%  >"%WLS_REDIRECT_LOG%" 2>&1 
)


可以正常启动了。



郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。