weblogic 安装成windows服务

参考:http://middleware123.com/weblogic/docs100/server_start/winservice.html
http://docs.oracle.com/cd/E15523_01/web.1111/e13708/winservice.htm#i1188090
http://docs.oracle.com/cd/E15523_01/web.1111/e13708/winservice.htm
本文翻译来自于官方:
http://docs.oracle.com/cd/E13222_01/wls/docs81b/adminguide/winservice.html

安装脚本在这里,%WL_HOME%\server\bin\installSvc.cmd,WL_HOME指weblogic程序的安装目录,

先创建一个脚本比如叫installWindowsServer.cmd,脚本放在你要注册的weblogic服务目录下面(weblogic服务目录: 在domains目录的weblogic服务目录下,有一个config目录,config目录下有一个config.xml文件),脚本如下:

里面要改几个参数 

set DOMAIN_NAME=base_domain 

set SERVER_NAME=AdminServer

set USERDOMAIN_HOME=C:\oracle\Middleware\user_projects\domains\base_domain

set WL_HOME=C:\oracle\Middleware\wlserver_10.3

设置服务的installWindowsServer.cmd脚本如下 :参考


@rem *************************************************************************
@rem This script sets up a WebLogic Server instance as a Windows service.
@rem It sets variables to specify the domain name, server name, and optionally,
@rem user credentials, startup mode, and arguments for the JVM. Then the script
@rem calls the %WL_HOME%\server\bin\installSvc.cmd script.
@rem *************************************************************************
echo off
SETLOCAL
set WL_HOME=C:\oracle\Middleware\wlserver_10.3


@rem Set DOMAIN_NAME to the name of the domain in which you have defined
@rem the server instance.
set DOMAIN_NAME=base_domain 
@rem Set USERDOMAIN_HOME to the root directory of the domain's Administration
@rem Server, which is the directory that contains the domain's config.xml file.
@rem For more information about the root directories for servers, refer to 
@rem A Server's Root Directory.
set USERDOMAIN_HOME=C:\oracle\Middleware\user_projects\domains\base_domain
@rem Set SERVER_NAME to the name of the existing server instance that you want 
@rem set up as a Windows service.
set SERVER_NAME=AdminServer
@rem Optional: one way of bypassing the username and password prompt during
@rem server startup is to set WLS_USER to your system username and WLS_PW to 
@rem your password. The script encrypts the login credentials and stores them
@rem in the Windows registry.
@rem The disadvantage to this method is that changing the username or password
@rem for the server instance requires you to delete the Windows service and set
@rem up a new one with the new username and password. 
@rem If you use a boot identity file to bypass the prompt, you can change the
@rem login credentials without needing to modify the Windows service. For more
@rem information about bypassing the username and password prompt, refer to 
@rem "Bypassing the Prompt for Username and Password" in the Administration
@rem Console Online Help.
set WLS_USER=
set WLS_PW=
@rem Optional: set Production Mode. When STARTMODE is set to true, the server
@rem starts in Production Mode. When not specified, or when set to false, the 
@rem server starts in Development Mode. For more information about 
@rem Development Mode and Production Mode, refer to 
@rem "Starting in Development Mode or Production Mode" in the Administration
@rem Console Online Help.
set STARTMODE=
@rem Set JAVA_OPTIONS to the Java arguments you want to pass to the JVM. Separate
@rem multiple arguments with a space.
@rem If you are using this script to set up a Managed Server as a Windows service,
@rem you must include the -Dweblogic.management.server argument, which 
@rem specifies the host name and listen port for the domain's Administration
@rem Server. For example:
@rem set JAVA_OPTIONS=-Dweblogic.management.server=http://adminserver:7501 
@rem For more information, refer to
@rem "weblogic.Server Configuration Options" in the WebLogic Server Command
@rem Reference.
set JAVA_OPTIONS=
@rem Optional: set JAVA_VM to the java virtual machine you want to run. 
@rem For example:
@rem set JAVA_VM=-server 
set JAVA_VM=
@rem Set MEM_ARGS to the memory args you want to pass to java. For example:
@rem set MEM_ARGS=-Xms32m -Xmx200m
set MEM_ARGS=
@rem Call Weblogic Server service installation script. Replace <WL_HOME> with
@rem the absolute pathname of the directory in which you installed WebLogic
@rem Server. For example:
@rem call "D:\bea\weblogic810\server\bin\installSvc.cmd"
call "%WL_HOME%\server\bin\installSvc.cmd"
ENDLOCAL


以上就是脚本文件内容,运行脚本这样就能执行成功了,看下window servers里面有没有服务,以beasvc开头,有就成功,没有就是失败了


另外:如果你在同一个电脑上设置了Administration Server 和 Managed Server,你可以让Administration Server 先执行,Managed Server后执行,通过下面的步骤设置:

        打开WL_HOME\server\bin\installSvc.cmd 主执行脚本,文件结尾有一行里有beasvc ,在这一行里加上 -dependservice_names ,这个是指定依赖的服务名,-delaydelay_milliseconds 这个是指定延迟多久才执行后面的服务,注意前面有空格,参考如下:
"%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% -depend: xxxx这个是依赖的服务名 -delay: 30000

    备注:如果你使用域向导创建域和服务,一些域模板会提示你是否创建windows服务,选是,应会自动创建服务了,如果你想创建有依赖的管理服务,这里就要选否了,按本文的方法设置,无论你是选是还是选no,都会创建一个 namedinstallService.cmd 的脚本在服务的根目录,同上面的脚本是相似的


    以上脚本真实有效,经本人测试,如有问题请留言,如有错误我会改正


    下面是删除服务的脚本,官方的,没验证过

     


    Using

    @rem *************************************************************************
    @rem This script is used to uninstall a WebLogic Server service for a
    @rem server instance that is defined for the current domain. 
    @rem The script simply sets the DOMAIN_NAME and SERVER_NAME variables and calls
    @rem the %WL_HOME%\server\bin\uninstallSvc.cmd script.
    @rem *************************************************************************
    echo off
    SETLOCAL
    @rem Set DOMAIN_NAME to the name of the domain that contains the server.
    set DOMAIN_NAME=myWLSdomain 
    @rem Set SERVER_NAME to the name of the server that you want to remove as
    @rem a service.
    set SERVER_NAME=myWLSserver 
    @rem Call Weblogic Server service uninstallation script. Replace <WL_HOME> with
    @rem the absolute pathname of the directory in which you installed WebLogic
    @rem Server. For example:
    @rem call "D:\bea\weblogic810\server\bin\uninstallSvc.cmd"
    call "<WL_HOME>\server\bin\uninstallSvc.cmd"
    ENDLOCAL


    • 0
      点赞
    • 1
      收藏
      觉得还不错? 一键收藏
    • 0
      评论

    “相关推荐”对你有帮助么?

    • 非常没帮助
    • 没帮助
    • 一般
    • 有帮助
    • 非常有帮助
    提交
    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值