1

JBoss will not start with my current configuration. I receive the error:

Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Press any key to continue . . .

The JAVA_OPTS being used by JBoss are:

-client 
-Dprogram.name=standalone.bat 
-Xms128 
-Xmx2G 
-XX:MaxPermSize=256M 
-Djava.net.preferIPv4Stack=true 
-Djboss.modules.system.pkgs=org.jboss.byteman 
-Xms1024m 
-Xmx2048m 
-XX:PermSize=32m 
-XX:MaxPermSize=512m 
-Xss2m 
-XX:+UseConcMarkSweepGC 
-XX:+CMSClassUnloadingEnabled 
-Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl 
-Djavax.xml.soap.SOAPConnectionFactory=org.apache.axis.soap.SOAPConnectionFactor‌​yImpl 
-Djavax.xml.soap.SOAPFactory=org.apache.axis.soap.SOAPFactoryImpl"
Michael
  • 7,348
  • 10
  • 49
  • 86
Z.I.J
  • 1,157
  • 16
  • 36
  • 1
    You question is impossible to answer without more detail - how are you trying to run JBoss (from a command-line, in an IDE, etc) and what VM options have been set, specifically the heap and perm-gen sizes – Nick Holt Sep 12 '14 at 10:28
  • I am trying to run JBoss (from bin directory and then double click on standalone-full.bat file). – Z.I.J Sep 12 '14 at 10:49
  • #Nick Holt, I don't know how to set VM options specifically the head and perm-gen sizes, please advice me. – Z.I.J Sep 12 '14 at 10:51
  • JAVA_OPTS: "-client -Dprogram.name=standalone.bat -Xms128 -Xmx2G -XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Xms1024m -Xmx2048m -XX:PermSize=32m -XX:MaxPermSize=512m -Xss2m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl -Djavax.xml.soap.SOAPConnectionFactory=org.apache.axis.soap.SOAPConnectionFactoryImpl -Djavax.xml.soap.SOAPFactory=org.apache.axis.soap.SOAPFactoryImpl" – Z.I.J Sep 12 '14 at 11:16

3 Answers3

2

From the JAVA_OPTS you're setting the maximum heap to 2048m (2G) which won't work on a Win32 - it's the -Xmx2048m option that controls this (which seems to be being set twice).

To run on a Win32 you should adjust the -Xms and -Xmx options. On a vanilla JBoss installation (well on my JBoss installation at least) both options are set in standalone.conf.bat. Try setting both to 1024m to start with and reduce if you're still having problems.

It's also likely that you'll want to turn down the -XX:MaxPermSize (which again is being set twice). 256m may work but if not try using 128m.

Nick Holt
  • 33,455
  • 4
  • 52
  • 58
  • Good spot on some of the arguments being set twice. @Z.I.J You'll want to tidy that up. – Michael Sep 12 '14 at 11:52
  • Currently in jboss batch file is: set JAVA_OPTS=%JAVA_OPTS% -Xms1024m -Xmx2048m -XX:PermSize=32m : I have changed into set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx512m -XX:PermSize=32m now working fine. thanks Nick Holt and Mikaveli – Z.I.J Sep 12 '14 at 12:38
1

To reuse portions of this answer of mine (about Tomcat, but applies to JBoss or any Java process):

The Windows OS limits the memory allocation of a 32-bit process to 2 GiB in total (by default).

[You will only be able] to allocate around 1.5 GiB heap space because there is also other memory allocated to the process (the JVM / library overhead, perm gen space etc.).

Why does 32-bit Windows impose a 2 GB process address space limit, but 64-bit Windows impose a 4GB limit?

Other modern operating systems [cough Linux] allow 32-bit processes to use all (or most) of the 4 GiB addressable space.

That said, 64-bit Windows OS's can be configured to increase the limit of 32-bit processes to 4 GiB (3 GiB on 32-bit):

http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778(v=vs.85).aspx

However [as others have stated], the best solution is to use a 64-bit JVM with your 64-bit OS. Terabyte heaps anyone? :D

So, you won't be able to set -Xmx2048m in your Java opts, but -Xmx1024m will work - as should a value approaching 1.5 GiB (but the exact figure varies).

Community
  • 1
  • 1
Michael
  • 7,348
  • 10
  • 49
  • 86
  • Currently in jboss batch file is: set JAVA_OPTS=%JAVA_OPTS% -Xms1024m -Xmx2048m -XX:PermSize=32m : I have changed into set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx512m -XX:PermSize=32m now working fine – Z.I.J Sep 12 '14 at 12:41
0

You should use 64-bit OS. you will face a lot of problems with 32-bit OS while working on jboss6, jdk1.7 etc...

nwzhaider
  • 359
  • 1
  • 3
  • 16
  • 2
    Is upgrade your PC and OS really an answer? A Win32 will still afford you a 2GB process, which will be more than capable of running a JVM with a 1GB heap. There's a likely to be something else wrong if JBoss won't fit in that – Nick Holt Sep 12 '14 at 09:56
  • nwzhaider you mean we can't configure on 32bit window machine. – Z.I.J Sep 12 '14 at 10:11
  • I have not choice to update OS 32bit to 64bit.. please help to configure jboss6 on 32bit machine. – Z.I.J Sep 12 '14 at 10:13
  • @nwzhaider Including why they should use a 64-bit OS beyond "facing problems" would improve the value of this answer. – Michael Sep 12 '14 at 11:54