views:

1047

answers:

3

hi. I'm running JBoss as a windows service, but i can't seem to find where i can configure 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?

+2  A: 

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
Thanks, i'll take a look at that
I use JBoss 4, so i don't think it is included in that version
I use JBoss 4.2.3. There's a link on the page I linked to download the jboss native binaries for your platform.
karoberts
Ah, found it now :)I will try that now. Any tip how i can get set the jboss_out.log and the JBoss_err.log path, as i had in my main post :"-out %PROJECT_HOME%\log\JBoss_out.log -err %PROJECT_HOME%\log\JBoss_err.log"
In service.bat, add redirection to the "call run.bat" line under cmdStart:, something like "call run.bat > out.log 2> err.log"
karoberts
Thanks!I'll try that tomorrow :)
+1  A: 

@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.

volothamp
i'm using JBoss 4, and as i said in the second paragraph, i edited the run.bat and executed it, and it worked perfect. But when i installed it as a service, it would not work. I only get 64MB as max memory.
The service.bat file print the JAVA_OPTS in the run.log file. Would you mind posting your output?
volothamp
Did not install it as a service in using service.bat, but i'm trying that tomorrow :)
A: 

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

huo73