windows环境安装weblogic服务【转】【补】

我的环境:

windows: win10 professional edition

jdk: C:\Program Files\Java\jdk1.6.0_45

weblogic安装目录 (WEBLOGIC_HOME): C:\Oracle\Middleware\wlserver_10.3

weblogic域目录 (DOMAIN_HOME): C:\Oracle\Middleware\user_projects\domains\base_domain

weblogic版本: weblogic 11g (10.3.6 version) 

 

准备工作:

weblogic安装完以后,为了安全,我们先备份一份WEBLOGIC_HOME\server\bin文件夹(初始只有2Mb大小)

开始

修改WEBLOGIC_HOME\server\bin\installSvc.cmd文件

原始语句:

set WL_HOME=C:\Oracle\Middleware\wlserver_10.3  
call "%WL_HOME%\common\bin\commEnv.cmd"

在以上语句后追加,特别注意每个set的变量都要新起一行

@rem ******************************************************
@rem jdk安装目录
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45
@rem 域名称
set DOMAIN_NAME=base_domain
@rem 管理服务器的名称
set SERVER_NAME=AdminServer
@rem 创建域的的实际目录地址
set USERDOMAIN_HOME=C:\Oracle\Middleware\user_projects\domains\base_domain
@rem 创建域的的实际目录地址
set DOMAIN_HOME=C:\Oracle\Middleware\user_projects\domains\base_domain
@rem 用户名
set WLS_USER=weblogic
@rem 密码
set WLS_PW=weblogic123
@rem JVM选项配置
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dfile.encoding=utf-8 -Dweblogic.Stdout="C:/Oracle/Middleware/logs/stdout.txt" -Dweblogic.Stderr="C:/Oracle/Middleware/logs/stderr.txt"
@rem 内存参数
set MEM_ARGS=-Xms512m -Xmx1024m -XX:MaxPermSize=256m
@rem ******************************************************* 

 

 

以管理员身份运行installSvc.cmd.

Win+R手动输入services.msc打开服务,确认beasvc base_domain_AdminServer这个服务是否存在.

开一个cmd窗口,切换目录到WEBLOGIC_HOME\server\bin\

调试刚准备好的服务,输入beasvc.exe -debug "beasvc base_domain_AdminServer"

C:\Oracle\Middleware\wlserver_10.3\server\bin>beasvc.exe -debug "beasvc base_domain_AdminServer"

Debugging service ....... beasvc base_domain_AdminServer

Command Line: ....... -client -Xms512m -Xmx1024m -XX:MaxPermSize=256m  -Xverify:none -Dfile.encoding=utf-8 -Dweblogic.Stdout=C:/Oracle/Middleware/logs/stdout.tx
t -Dweblogic.Stderr=C:/Oracle/Middleware/logs/stderr.txt -classpath "C:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\sys_manifest_classpath\weblogic_patch.jar
;C:\Oracle\MIDDLE~1\patch_ocp371\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\PROGRA~1\Java\JDK16~1.0_4\lib\tools.jar;C:\Oracle\MIDDLE~1\WLSERV
~1.3\server\lib\weblogic_sp.jar;C:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.jar;C:\Oracle\MIDDLE~1\modules\features\weblogic.server.modules_10.3.6.0.jar;C
:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\webservices.jar;C:\Oracle\MIDDLE~1\modules\ORGAPA~1.1/lib/ant-all.jar;C:\Oracle\MIDDLE~1\modules\NETSFA~1.0_1/lib/ant-co
ntrib.jar;.;$JAVA_HOME/lib/dt.jar;$JAVA_HOME/lib/tools.jar" -Dweblogic.Name=AdminServer -Dweblogic.management.username=weblogic -Dweblogic.ProductionModeEnabled
= -Djava.security.policy="C:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.policy" weblogic.Server

Current Directory: ....... C:\Oracle\Middleware\user_projects\domains\base_domain

Path: ....... C:\Oracle\MIDDLE~1\WLSERV~1.3\server\native\win\x64\;C:\Oracle\MIDDLE~1\WLSERV~1.3\server\bin;C:\Program Files\Java\jdk1.6.0_45\jre\bin;C:\Program
 Files\Java\jdk1.6.0_45\bin;C:\Oracle\MIDDLE~1\WLSERV~1.3\server\native\win\x64\oci920_8;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Syst
em32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_45/bin;
Java Home: ....... C:\Program Files\Java\jdk1.6.0_45

Delay: ....... 0

Thread created successfully!
Unrecognized option: -client

Error in java application .......

The following line contains specific error details .......
Unable to initialize the Java virtual machine!
C:\Oracle\Middleware\wlserver_10.3\server\bin>

发现是虚拟机问题,多了一个-client启动参数.

Win+R手动输入regedit打开注册表, 定位HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\beasvc BASE_DOMAIN_AdminServer\Parameters, 在CmdLine这个属性处删掉最前面的-client.

 再次在cmd界面输入输入beasvc.exe -debug "beasvc base_domain_AdminServer"一般是正常启动了,但这个时候会显示乱码.

因为cmd界面默认GBK显示,weblogic正常启动输出日志很可能为乱码,因为在开始设置了-Dfile.encoding=utf-8所以导致了编码不一致.

改变cmd界面以UTF-8显示,在任意cmd中输入chcp 65001 改成UTF-8窗口,且改变窗口显示风格成Lucida Console

 

 再启动就不乱码了

C:\Oracle\Middleware\wlserver_10.3\server\bin>beasvc.exe -debug "beasvc base_domain_AdminServer"

Debugging service ....... beasvc base_domain_AdminServer

Command Line: ....... -Xms512m -Xmx1024m -XX:MaxPermSize=256m  -Xverify:none -Dfile.encoding=utf-8 -Dweblogic.Stdout=C:/Oracle/Middleware/logs/stdout.txt -Dwebl
ogic.Stderr=C:/Oracle/Middleware/logs/stderr.txt -classpath "C:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\Orac
le\MIDDLE~1\patch_ocp371\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\PROGRA~1\Java\JDK16~1.0_4\lib\tools.jar;C:\Oracle\MIDDLE~1\WLSERV~1.3\ser
ver\lib\weblogic_sp.jar;C:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.jar;C:\Oracle\MIDDLE~1\modules\features\weblogic.server.modules_10.3.6.0.jar;C:\Oracle
\MIDDLE~1\WLSERV~1.3\server\lib\webservices.jar;C:\Oracle\MIDDLE~1\modules\ORGAPA~1.1/lib/ant-all.jar;C:\Oracle\MIDDLE~1\modules\NETSFA~1.0_1/lib/ant-contrib.ja
r;.;$JAVA_HOME/lib/dt.jar;$JAVA_HOME/lib/tools.jar" -Dweblogic.Name=AdminServer-Dweblogic.management.username=weblogic -Dweblogic.ProductionModeEnabled= -Djava
.security.policy="C:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.policy" weblogic.Server

Current Directory: ....... C:\Oracle\Middleware\user_projects\domains\base_domain

Path: ....... C:\Oracle\MIDDLE~1\WLSERV~1.3\server\native\win\x64\;C:\Oracle\MIDDLE~1\WLSERV~1.3\server\bin;C:\Program Files\Java\jdk1.6.0_45\jre\bin;C:\Program
 Files\Java\jdk1.6.0_45\bin;C:\Oracle\MIDDLE~1\WLSERV~1.3\server\native\win\x64\oci920_8;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Syst
em32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_45/bin;

Java Home: ....... C:\Program Files\Java\jdk1.6.0_45

Delay: ....... 0

Thread created successfully!
<2017-11-17 下午07时36分06秒 CST> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this
check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true>n=true>
<2017-11-17 下午07时36分06秒 CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable
this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true>G=true>
<2017-11-17 下午07时36分08秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 20.45-b01 from Sun Mi
crosystems Inc.>s Inc.>
<2017-11-17 下午07时36分09秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.6.0  Tue Nov 15 08:52:36 PST 2011 1441050 >41050 >
<2017-11-17 下午07时36分10秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>ARTING>
<2017-11-17 下午07时36分10秒 CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool>d pool>

虽然卡在<Initializing self-tuning thread pool>d pool>这句话这里,但其实已经正常启动了.现在就可以去找开控制台http://localhost:7001/console登录了.

在以上步骤都成功以后,关掉cmd,去服务那里手动启动beasvc base_domain_AdminServer服务,让服务变成已启动就OK了,以后windows重启系统后会自动把weblogic 管理控制台一并启动.

 

附我的installSvc.cmd实际配置

@rem *************************************************************************
@rem This script is used to install WebLogic Server as a Windows Service.
@rem
@rem To create your own start script for your domain, simply set the 
@rem SERVER_NAME variable to your server name then call this script from your
@rem domain directory.
@rem
@rem This script sets the following variables before installing 
@rem WebLogic Server as a Windows Service:
@rem
@rem WL_HOME    - The root directory of your WebLogic installation
@rem JAVA_HOME  - Location of the version of Java used to start WebLogic 
@rem              Server. This variable must point to the root directory of a 
@rem              JDK installation and will be set for you by the installer. 
@rem              See the Oracle Fusion Middleware Supported System Configurations page 
@rem              (http://www.oracle.com/technology/software/products/ias/files/fusion_certification.html) 
@rem               for an up-to-date list of supported JVMs.
@rem PATH       - Adds the JDK and WebLogic directories to the system path.  
@rem CLASSPATH  - Adds the JDK and WebLogic jars to the classpath.  
@rem
@rem Other variables that installSvc takes are:
@rem
@rem WLS_USER     - admin username for server startup
@rem WLS_PW       - cleartext password for server startup
@rem ADMIN_URL    - if this variable is set, the server started will be a 
@rem                managed server, and will look to the url specified (i.e. 
@rem                http://localhost:7001) as the admin server.
@rem PRODUCTION_MODE    - set to true for production mode servers, false for 
@rem                development mode
@rem JAVA_OPTIONS - Java command-line options for running the server. (These
@rem                will be tagged on to the end of the JAVA_VM and MEM_ARGS)
@rem JAVA_VM      - The java arg specifying the VM to run.  (i.e. -server, 
@rem                -client, etc.)
@rem MEM_ARGS     - The variable to override the standard memory arguments
@rem                passed to java
@rem
@rem
@rem MAX_CONNECT_RETRIES - Number of attempts the Windows Service will make to check 
@rem                if the Weblogic Server is started. If this variable 
@rem                is specified along with HOST and PORT, the Windows Service will 
@rem                wait until the Weblogic Server is started.
@rem HOST         - IP address of the Weblogic Server  
@rem PORT         - Port number where the WebLogic Server is listening for requests 
@rem               
@rem jDriver for Oracle users: This script assumes that native libraries
@rem required for jDriver for Oracle have been installed in the proper
@rem location and that your system PATH variable has been set appropriately.
@rem 
@rem For additional information, refer to "Managing Server Startup and Shutdown for Oracle WebLogic Server"  
@rem (http://download.oracle.com/docs/cd/E23943_01/web.1111/e13708/overview.htm).
@rem *************************************************************************

@echo off
SETLOCAL


set WL_HOME=C:\Oracle\Middleware\wlserver_10.3
call "%WL_HOME%\common\bin\commEnv.cmd"


@rem ******************************************************
@rem jdk安装目录
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45
@rem 域名称
set DOMAIN_NAME=base_domain
@rem 管理服务器的名称
set SERVER_NAME=AdminServer
@rem 创建域的的实际目录地址
set USERDOMAIN_HOME=C:\Oracle\Middleware\user_projects\domains\base_domain
@rem 创建域的的实际目录地址
set DOMAIN_HOME=C:\Oracle\Middleware\user_projects\domains\base_domain
@rem 用户名
set WLS_USER=weblogic
@rem 密码
set WLS_PW=weblogic123
@rem JVM选项配置
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dfile.encoding=utf-8 -Dweblogic.Stdout="C:/Oracle/Middleware/logs/stdout.txt" -Dweblogic.Stderr="C:/Oracle/Middleware/logs/stderr.txt"
@rem 内存参数
set MEM_ARGS=-Xms512m -Xmx1024m -XX:MaxPermSize=256m
@rem ******************************************************* 



@rem Check that the WebLogic classes are where we expect them to be
:checkWLS
if exist "%WL_HOME%\server\lib\weblogic.jar" goto checkJava
echo The WebLogic Server wasn't found in directory %WL_HOME%\server.
echo Please edit your script so that the WL_HOME variable points 
echo to the WebLogic installation directory.
goto finish

@rem Check that java is where we expect it to be
:checkJava
if exist "%JAVA_HOME%\bin\java.exe" goto runWebLogic
echo The JDK wasn't found in directory %JAVA_HOME%.
echo Please edit your script so that the JAVA_HOME variable 
echo points to the location of your JDK.
goto finish

:runWebLogic

if not "%JAVA_VM%" == "" goto noResetJavaVM
if "%JAVA_VENDOR%" == "BEA" set JAVA_VM=-jrocket
if "%JAVA_VENDOR%" == "HP"  set JAVA_VM=-server
if "%JAVA_VENDOR%" == "Sun" set JAVA_VM=-server

:noResetJavaVM
if not "%MEM_ARGS%" == "" goto noResetMemArgs
set MEM_ARGS=-Xms32m -Xmx200m

:noResetMemArgs

@echo on

set CLASSPATH=%WEBLOGIC_CLASSPATH%;%CLASSPATH%

@echo ***************************************************
@echo *  To start WebLogic Server, use the password     *
@echo *  assigned to the system user.  The system       *
@echo *  username and password must also be used to     *
@echo *  access the WebLogic Server console from a web  *
@echo *  browser.                                       *
@echo ***************************************************

rem *** Set Command Line for service to execute within created JVM

@echo off

if "%ADMIN_URL%" == "" goto runAdmin
@echo on
set CMDLINE="%JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -classpath \"%CLASSPATH%\" -Dweblogic.Name=%SERVER_NAME% -Dweblogic.management.username=%WLS_USER% -Dweblogic.management.server=\"%ADMIN_URL%\" -Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE% -Djava.security.policy=\"%WL_HOME%\server\lib\weblogic.policy\" weblogic.Server"
goto finish

:runAdmin
@echo on
set CMDLINE="%JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -classpath \"%CLASSPATH%\" -Dweblogic.Name=%SERVER_NAME% -Dweblogic.management.username=%WLS_USER% -Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE% -Djava.security.policy=\"%WL_HOME%\server\lib\weblogic.policy\" weblogic.Server"

:finish
rem *** Set up extrapath for win32 and win64 platform separately
if "%WL_USE_X86DLL%" == "true" set EXTRAPATH=%WL_HOME%\server\native\win\32;%WL_HOME%\server\bin;%JAVA_HOME%\jre\bin;%JAVA_HOME%\bin;%WL_HOME%\server\native\win\32\oci920_8

if "%WL_USE_IA64DLL%" == "true" set EXTRAPATH=%WL_HOME%\server\native\win\64\;%WL_HOME%\server\bin;%JAVA_HOME%\jre\bin;%JAVA_HOME%\bin;%WL_HOME%\server\native\win\64\oci920_8

if "%WL_USE_AMD64DLL%" == "true" set EXTRAPATH=%WL_HOME%\server\native\win\x64\;%WL_HOME%\server\bin;%JAVA_HOME%\jre\bin;%JAVA_HOME%\bin;%WL_HOME%\server\native\win\x64\oci920_8

rem *** Install the service
"%WL_HOME%\server\bin\beasvc" -install -svcname:"beasvc %DOMAIN_NAME%_%SERVER_NAME%" -javahome:"%JAVA_HOME%" -execdir:"%USERDOMAIN_HOME%" -maxconnectretries:"%MAX_CONNECT_RETRIES%" -host:"%HOST%" -port:"%PORT%" -extrapath:"%EXTRAPATH%" -password:"%WLS_PW%" -cmdline:%CMDLINE%

ENDLOCAL
View Code

 

卸载windows服务

本方法为通用方法,不仅限于weblogic.

在服务界面,右击-->属性-->复制weblogic的服务名称 beasvc base_domain_AdminServer, 先关掉服务,以管理员身份启动cmd界面,输入sc delete "beasvc base_domain_AdminServer" 删除weblogic服务.

 

其它方式(使用任务计划启动weblogic):

Weblogic Server 启动脚本

 

主要参考:

weblogic10.3.6 自动启动服务后停止的解决方案 (极佳)

WEBLOGIC注册为WINDOWS的系统服务项

posted @ 2017-11-17 17:21  苦涩泪滴  阅读(1182)  评论(0编辑  收藏  举报