I'm running JBoss as a windows service, but i can't seem to find where i can 开发者_StackOverflowconfigure the JAVA_OPTS to make it work properly. I need to set the Xms and the Xmx.
I have tried to just run JBoss manually (run.bat) and in the same file i set the JAVA_OPTS= -Xms128m -Xmx512m. And that works.
Here is my install.bat where i install the JBoss as a service:
set JBOSS_CLASS_PATH=%JAVA_HOME%\lib\tools.jar;%JBOSS_HOME%\bin\run.jar
rem copy /Y JavaService.exe D:\PROJECT\bin\JBossService.exe
JBossService.exe -install JBoss %JAVA_HOME%\jre\bin\server\jvm.dll -Djava.class.path=%JBOSS_CLASS_PATH% -start org.jboss.Main -stop org.jboss.Shutdown -method systemExit -out %PROJECT_HOME%\log\JBoss_out.log -err %PROJECT_HOME%\log\JBoss_err.log -current D:\PROJECT\bin
net start JBoss
When i look at the info about JBoss Application Server (http://localhost:8080/web-console/) i see this info:
JVM Environment
Free Memory: 9 MB
Max Memory: 63 MB
Total Memory: 63 MB
And i MUST have more Max Memory.
Does anybody know where i can set the JAVA_OPTS when running JBoss as a service?
We use jbosssvc.exe to run JBoss as a service. It basically runs your run.bat, so you can include all the customizations you want.
http://community.jboss.org/wiki/JBossNativeWindows
In the bin directory of jboss, there's a service.bat that can install the service.
@karoberts answer is correct, although is different between version 4 and 5:
In JBoss 4:
{jboss.home}\bin\run.bat
In JBoss 5:
{jboss.home}\bin\run.conf.bat
Which one are you using?
The
service.bat
script of jboss native calls run.bat so you should put your JAVA_OPTS in there using the syntax
set "JAVA_OPTS=%JAVA_OPTS% -Dyoutoptionsgoeshere
Note: you won't find the service.bat in the bin anymore since JBoss 5. It's in a different package.
Another tip: If you have multiple Java Versions installed on your server and JBoss(4.2.3) service needs an older Version, you have to define the JAVA var in service.bat. If you use the run.bat also sometimes, then you need to define the JAVA var there too. I know that the service.bat calls the run.bat, but I tried just defining the JAVA var in the run.bat, when I then ran the service it ignored the new JAVA var content from run.bat
Here an example of how to set the JAVA var :
set JAVA_HOME=C:\Program Files (x86)\Java\jre6
set JAVA=%JAVA_HOME%\bin\java
If you use JavaService.exe as desribed above you can configure JVM options in the Windows Registry:
1.) Execute regedit.exe
2.) Goto HKEY_LOCAL_MACHINE\CurrentControlSet\Services\JBoss\Parameters
3.) After initial installation you find a parameter "JVM Option Count" wich is set to 1 and "JVM Option Number 0" which basically contains a class path.
4.) Increase the value of "JVM Option Count" to 3
5.) Add a REG_SZ Parameter "JVM Option Number 1" and assign it the Value -Xms128m
6.) Add a REG_SZ Parameter "JVM Option Number 2" and assign it the Value -Xmx512m
Regards
精彩评论