[转帖]WebLogic定时重启的一些注意事项_Tomcat, WebLogic及J2EE讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Tomcat, WebLogic及J2EE讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3713 | 回复: 0   主题: [转帖]WebLogic定时重启的一些注意事项        下一篇 
lengyuLee
注册用户
等级:少校
经验:1118
发帖:83
精华:5
注册:2013-3-7
状态:离线
发送短消息息给lengyuLee 加好友    发送短消息息给lengyuLee 发消息
发表于: IP:您无权察看 2013-3-11 11:14:05 | [全部帖] [楼主帖] 楼主

文章转载自: http://bbs.weblogicfans.net/viewthread.php?tid=2254&extra=page%3D1%26amp%3Bfilter%3Ddigest&page=1

Weblogic定时启动,首先需要注册Windows的一个服务,这里需要一个文件installServer.cmd或者installSvc.cmd,需要放到自己创建的Domain下面(我的是D:\WebLogic\user_projects\domains\my_domain),下面是这个文件的内容:

@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 WebLogic platform support page
@rem (http://e-docs.bea.com/wls/platforms/index.html) for an up-to-date list of
@rem supported JVMs on Windows NT.
@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 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 the WebLogic Server Administration
@rem Guide (@DOCSWEBROOT/adminguide/startstop.html).
@rem *************************************************************************
@echo off
SETLOCAL
@rem注释1:(红色部分是根据自身情况需要您修改的)
set WL_HOME=D:\WebLogic\weblogic92
call "%WL_HOME%\common\bin\commEnv.cmd"
@rem Set JAVA_VENDOR to java virtual machine you want to run on server side.
set JAVA_VENDOR=BEA
@rem Set JAVA_HOME to java virtual machine you want to run on server side.
set JAVA_HOME=D:\WebLogic\jrockit90_150_04
@rem USERDOMAIN_HOME is preset to the domain directory.
set USERDOMAIN_HOME=D:\WebLogic\user_projects\domains\my_domain
@rem Set SERVER_NAME to the name of the server you wish to start up.
set SERVER_NAME=AdminServer
@rem Set DOMAIN_NAME to the name of the server you wish to start up.
set DOMAIN_NAME=my_domain
@rem Set WLS_USER equal to your system username and WLS_PW equal
@rem to your system password for no username and password prompt
@rem during server startup. Both are required to bypass the startup
@rem prompt.
set WLS_USER=weblogic
set WLS_PW=weblogic
@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%\" -Duser.timezone=GMT+8 -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
@rem注释2:(这部分是解决JDK的一个时间Bug)
:runAdmin
@echo on
set CMDLINE="%JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -classpath \"%CLASSPATH%\" -Duser.timezone=GMT+8 -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%" -extrapath:"%EXTRAPATH%" -password:"%WLS_PW%" -cmdline:%CMDLINE% -log:"test.log"
ENDLOCAL


在路径:D:\WebLogic\user_projects\domains\my_domain下执行installSvc.cmd
这是将创建一个服务beasvc my_domain_AdminServer,如果在注释1中的JDK没设定好,(对于Weblogic有三种JDK可供选择:1、自己安装的JDK C:\Program Files\Java\jdk1.6.0_11;2、Weblogic自带的其中一个JDK D:\WebLogic\jdk150_04;3、Weblogic自带的另一个JDK D:\WebLogic\jrockit90_150_04)。
如果选择的是前两JDK则会出现这种情况:
手动启动服务的时候,弹出一个对话框“本地计算机上的"beasv my_domain_AdminServer"服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止。”;如果是使用net start启动服务,服务将启动失败,日志中提示Java虚拟机出错。(具体什么原因,不清楚)
所以选择第三个JDk。
从激活时间来看服务是否已经重启,其中“GMT+8”是解决JDK的时间Bug加上去的。这是注释2中需要注意的。
删除Windows服务,在命令行窗口下使用:sc delete “beasvc my_domain_AdminServer”
接着就是创建一个文件plan.cmd,里面内容是:

net stop “beasvc my_domain_AdminServer”
net start “beasvc my_domain_AdminServer”


然后使用Windows的任务计划,进行定时执行这个文件。
按照windows服务启动还应该注意最重要一点,如果启动的管理账户的密码改动,必须删除服务,然后重新部署服务。否则机器重启时weblogic根本无法启动。(出处:www.weblogicfans.net的wonderfulhaiya)




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论