首页 文章

如何将weblogic域作为windows服务运行

提问于
浏览
0

我在weblogic服务器版本10.3.6上创建了一个域 . 之后,我在该域上部署了war文件 . 我的Windows服务器是server 2003

当我在mydomain \ bin中启动startWebLogic.cmd时,我的服务器工作正常 . 当我注销时它会自动停止 . 在这里,我尝试创建一个窗口服务,如oracle docs“http://docs.oracle.com/cd/E11035_01/wls100/server_start/winservice.html”所述 .

但我的服务停止说它无关 .

这是我创建的2个文件

1.)D:\ WebLogic \ user_projects \ domains \ TEST \ bin中的run.cmd

{

SETLOCAL
set DOMAIN_NAME=TEST

set USERDOMAIN_HOME=D:\WebLogic\user_projects\domains\TEST

set WL_HOME=D:\WebLogic\wlserver_10.3
set SERVER_NAME=AdminServer
set JAVA_HOME=D:\Java\jdk1.7.0_79\jdk1.7.0_79

set WLS_USER=weblogic
set WLS_PW=weblogic123
pause
set PRODUCTION_MODE=true
pause
CALL D:\WebLogic\wlserver_10.3\server\bin\installSvc_Ank.cmd
pause
ENDLOCAL

}

2.)在D:\ WebLogic \ wlserver_10.3 \ server \ bin中安装SVC.cmd

{

@echo off
SETLOCAL



set ADMIN_URL=http://localhost:7005

set MEM_ARGS=-Xms256m -Xmx512m
pause




@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

pause

@rem Check that java is where we expect it to be
:checkJava
if exist "%JAVA_HOME%\bin\javaw.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

pause
: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

}

1 回答

  • 0

    尝试使用以下命令调试服务

    beasvc -debug "<your_windows_service_name>"
    

相关问题