我有一个JBOSS AS 7.1.1.final在Windows 7上作为服务运行。但是,问题是由于这行(来自service.bat),它忽略了我的JAVA_OPTS来自standalone.bat。
set JAVA_OPTS=-Xrs
所以,因为我有一些内存问题,我不得不评论该行,以便我的服务看到我的standalone.bat。这在Windows 7上完美运行。
但是,当我在Windows Server 2008上使用它时,它不再起作用了。如果该行被注释,该服务根本不会启动,这会吸引内存问题。
我该怎么办?
稍后编辑:
我的service.bat:
@echo off
@if not "%ECHO%" == "" echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal
set DIRNAME=%CD%
set SVCNAME=SERVER
set SVCDISP=SERVER
set SVCDESC=Jboss7.1.1 GA/Platform: Windows x86
set NOPAUSE=Y
REM set JAVA_OPTS=-Xrs
REM Figure out the running mode
if /I "%1" == "install" goto cmdInstall
if /I "%1" == "uninstall" goto cmdUninstall
if /I "%1" == "start" goto cmdStart
if /I "%1" == "stop" goto cmdStop
if /I "%1" == "restart" goto cmdRestart
if /I "%1" == "signal" goto cmdSignal
echo Usage: service install^|uninstall^|start^|stop^|restart^|signal
goto cmdEnd
:errExplain
if errorlevel 1 echo Invalid command line parameters
if errorlevel 2 echo Failed installing %SVCDISP%
if errorlevel 4 echo Failed removing %SVCDISP%
if errorlevel 6 echo Unknown service mode for %SVCDISP%
goto cmdEnd
:cmdInstall
jbosssvc.exe -iwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service.bat
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% installed
goto cmdEnd
:cmdUninstall
jbosssvc.exe -u %SVCNAME%
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% removed
goto cmdEnd
:cmdStart
REM Executed on service start
del .r.lock 2>&1 | findstr /C:"being used" > nul
if not errorlevel 1 (
echo Could not continue. Locking file already in use.
goto cmdEnd
)
echo Y > .r.lock
jbosssvc.exe -p 1 "Starting %SVCDISP%" > standalone.log
echo jbosssvc.exe -p passed
call standalone.bat < .r.lock >> standalone.log 2>&1
echo standalone.bat passed
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> standalone.log
del .r.lock
goto cmdEnd
:cmdStop
REM Executed on service stop
echo Y > .s.lock
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > shutdown.log
call jboss-cli.bat --connect command=:shutdown >> shutdown.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> shutdown.log
del .s.lock
goto cmdEnd
:cmdRestart
REM Executed manually from command line
REM Note: We can only stop and start
echo Y > .s.lock
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" >> shutdown.log
call jboss-cli.bat --connect command=:shutdown >> shutdown.log 2>&1
del .s.lock
:waitRun
REM Delete lock file
del .r.lock > nul 2>&1
REM Wait one second if lock file exist
jbosssvc.exe -s 1
if exist ".r.lock" goto waitRun
echo Y > .r.lock
jbosssvc.exe -p 1 "Restarting %SVCDISP%" >> standalone.log
call standalone.bat --server-config=standalone.xml < .r.lock >> standalone.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> standalone.log
del .r.lock
goto cmdEnd
:cmdSignal
REM Send signal to the service.
REM Requires jbosssch.dll to be loaded in JVM
@if not ""%2"" == """" goto execSignal
echo Missing signal parameter.
echo Usage: service signal [0...9]
goto cmdEnd
:execSignal
jbosssvc.exe -k%2 %SVCNAME%
goto cmdEnd
:cmdEnd
和我的standalone.conf.bat:
rem Uncomment the following line to disable manipulation of JAVA_OPTS (JVM parameters)
rem set PRESERVE_JAVA_OPTS=true
if not "x%JAVA_OPTS%" == "x" (
echo "JAVA_OPTS already set in environment; overriding default settings with values: %JAVA_OPTS%"
goto JAVA_OPTS_SET
)
set "JAVA_OPTS=-Xms1024M -Xmx2048M -XX:MaxPermSize=256M -Xss2m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
rem # Reduce the RMI GCs to once per hour for Sun JVMs.
set "JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true"
rem # Warn when resolving remote XML DTDs or schemas.
set "JAVA_OPTS=%JAVA_OPTS% -Dorg.jboss.resolver.warning=true"
rem # Make Byteman classes visible in all module loaders
rem # This is necessary to inject Byteman rules into AS7 deployments
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=org.jboss.byteman"
rem # Set the default configuration file to use if -c or --server-config are not used
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.server.default.config=standalone.xml"
:JAVA_OPTS_SET