I'm trying to run several tools on a Windows Tomcat server . The server starts fine, and I can also see the manager page of Tomcat. But when I open a tool, an "OutOfMemoryError: PermGen space" occurs. I tried a lot with setting the MaxPermSize in my catalina.bat, this is my CATALINA_OPTS:
set CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms64m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"
When I run JVisualVM next to my Tomcat server, I can see that the arguments are picked up well:
But when I go to the monitor tab and check the PermGen, the max is 67mb instead of the 512 that I set my CATALINA_OPTS. So the arguments are set, but Tomcat ignores them..
I tried fixing this problem for a couple of hours already, but without success..
Anyone?
Remove the "" in the set and you are fine... Don't know why, yet. But that's the answer
set CATALINA_OPTS=-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms64m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
-- edit
Btw, I think you want the UseConcMarkSweepGC as well, otherwise the other 2 CMS parameters won't do a thing (and one of the 2 is only needed, depening on the version of the JVM)
See
What does JVM flag CMSClassUnloadingEnabled actually do?
-- edit 2
This question was also asked for tomcat6 here: https://serverfault.com/questions/64894/setting-catalina-opts-for-tomcat6-on-windows-doesnt-work
Too bad the blogger doesn't explain why you don't need to use quotes in windows.
http://javahowto.blogspot.nl/2006/06/6-common-errors-in-setting-java-heap.html
But I think it's because with the quotes it's seen as one big argument. The only thing that I don't understand is why the jvisualvm pretends you set it correctly. But I guess the display of the arguments doesn't actually look at how it's set in the JVM, but only formats the arguments nicely.
Related
When building a Java 8 project with Maven:
mvn clean package
I get this message:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
How to remove this message?
Compatibility Guide for JDK 8 says that in Java 8 the command line flag MaxPermSize has been removed. The reason is that the permanent generation was removed from the hotspot heap and was moved to native memory.
So in order to remove this message
edit MAVEN_OPTS Environment User Variable:
Java 7
MAVEN_OPTS -Xmx512m -XX:MaxPermSize=128m
Java 8
MAVEN_OPTS -Xmx512m
The JDK 8 HotSpot JVM is now using native memory for the representation of class metadata and is called Metaspace.
The permanent generation has been removed. The PermSize and MaxPermSize are ignored and a warning is issued if they are present on the command line.
-XX:MaxPermSize=size
Sets the maximum permanent generation space size (in bytes). This option was deprecated in JDK 8, and superseded by the -XX:MaxMetaspaceSize option.
-XX:PermSize=size
Sets the space (in bytes) allocated to the permanent generation that triggers a garbage collection if it is exceeded. This option was deprecated in JDK 8, and superseded by the -XX:MetaspaceSize option.
In JBoss EAP 6.4, right click on the server and open launch configuration under VM argument you will find
{-Dprogram.name=JBossTools: jboss-eap" -server -Xms1024m -Xmx1024m -XX:MaxPermSize=256m}
update it to
{-Dprogram.name=JBossTools: JBoss 6.4" -server -Xms512m -Xmx512m}
this will solve your problem.
I got similar message when running command line mvn (version 3.3.3) on Linux with Java 8.
By opening maven script /$MAVEN-HOME/bin/mvn, found the following line
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
Where $MAVEN_PROJECTBASEDIR by default is your home directory.
So two places you can take a look, first is file $MAVEN_PROJECTBASEDIR/.mvn/jvm.config if it exists. Secondly look at files possibly set up the environment variable MAVEN_OPTS. Candidate files are .bashrc, .bash_profile, .profile and those files included by them such as /etc/profile, /etc/bash.bashrc
I located
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
in .bashrc in my system, change it to
export MAVEN_OPTS="-Xmx512m"
issue resolved
in case some one still get this kind of message. Its happen because you add JVM argument when running maven project. Because it is related with maven you can check your pom.xml file on your project.
find this line <argLine>...</argLine>, on my project I also have argument below
<argLine>-Xmx1024m -XX:MaxPermSize=512m -XX:+TieredCompilation -XX:TieredStopAtLevel=1</argLine>
you should replace MaxPermSize argument as -Xms123m -Xmx123m, since MaxPermSize is already deprecated and wont take any effect on your JVM config :
<argLine>-Xms512m -Xmx512m -XX:+TieredCompilation -XX:TieredStopAtLevel=1</argLine>
Please to solve this problem we just have set installed JDK path in
standalone.conf
file which under the bin folder of JBoss\Wildfly Server. To solve this we do the following steps:
Open the standlone.conf file which under JBoss_or_wildfly\bin folder
Within this file find for #JAVA_HOME text.
Remove the # character and set your installed JDK path as
JAVA_HOME="C:\Program Files\Java\jdk1.8.0_65"
Hope this will solve your problem
Thanks
For Eclipse users...
Click Run —> Run configuration —> are —> set Alternate JRE for 1.6 or 1.7
I installed youtrack. Begin to adjust. And my message is shown:
"Not enough permanent generation memory. Please, refer to
documentation on how to increase it."
I went to the documentation. Sought there, tried to register at startup
exec $JAVA_HOME -Xms512m -Xmx1024m -jar $JAR"youtrack.jar" $PORT >> $LOG 2>&1 &
tried to set parameter.
java -XX:PermSize=1024m -XX:MaxPermSize=1024m -jar /usr/local/youtrack/youtrack.jar 8112
Still does not work. I use Ubuntu Server 10.04
This has worked for me:
java -XX:MaxPermSize=150m -Xmx512m -Djava.awt.headless=true -jar youtrack-<version>.jar 8080
JVM flag that controls PermGen size is -XX:MaxPermSize. Try to modify startup script for youtrack like this:
java -XX:MaxPermSize=1024m -Xmx1024m -jar /usr/local/youtrack/youtrack.jar 8112
Although, be advised that this may not work on Windows because Tomcat loves ignoring startup scripts. You may need to specify these JVM flags in Windows service properties window.
Or maybe a little bit fewer than 1024m, not sure you really need that much.
I'm using Mac OSX 10.9 and Intellij Idea 13 on a decked out machine (7i processor, 16GB RAM, 64 bit, etc.). I have things working well; however, it seems to me that Intellij is running pretty slow (approx. 5 mins to boot up, almost a full 2 minutes to compile a system out print line class, etc.). As a frame of reference I have looked through numerous posts and have landed on the configurations below. My question is this. Does anyone else use a similar set up and have it running quicker? If so, what modifications have you made to your environment to speed things up. Thanks in advance for any help.
Java Version:
Switched from jdk1.6 to jdk1.7
idea.vmoptions:
-ea
-server
-Xms1g
-Xmx1g
-Xss16m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
-XX:+UseConcMarkSweepGC
-XX:LargePageSizeInBytes=256m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
-XX:ParallelGCThreads=8
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:+DisableExplicitGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+PrintGCDetails
-XX:+PrintFlagsFinal
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
-XX:CMSInitiatingOccupancyFraction=60
-XX:+CMSClassUnloadingEnabled
-XX:+CMSParallelRemarkEnabled
-XX:+UseAdaptiveGCBoundary
-XX:+UseSplitVerifier
-XX:CompileThreshold=10000
-XX:+UseCompressedStrings
-XX:+OptimizeStringConcat
-XX:+UseStringCache
-XX:+UseFastAccessorMethods
-XX:+UnlockDiagnosticVMOptions
info.plist (modification):
<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>
</array>
<key>JVMVersion</key>
<string>1.7*</string>
I strongly suggest you not to use all these VM options (especially those controlling garbage collector) unless you actually measure they will improve performance.
Please report reproducable performance problems as described here https://intellij-support.jetbrains.com/entries/29983118-Reporting-performance-problems
Here's the scoop. There is a lot of stuff out there about changing the heap size, garbage collectors and what not. It may not be the root cause of your problem. Be sure to understand what you are setting in your vmoptions file as several suggestions aren't really supported any longer. I worked with the folks at IntelliJ going back and forth with log files and what not and it boils down to this. Check your anti virus. After adjusting my anti-virus, the following settings have IntelliJ screaming. Please note that this was the cause to my individual problem; so be sure to check your log files because that is where I started to find answers.
JDK 1.6
.vmoptions is running in the /Application/IntelliJ13/bin:
-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCompressedOops
*notice that you don't need to allocate huge amounts of system resources. If you set up your system correctly it isn't needed.
Idea.plist:
<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>
<string>i386</string>
</array>
<key>JVMVersion</key>
<string>1.6*</string>
I know it is simple but it works.
I have JBOSS installed in my Windows 7 machine., I can start JBOSS from Eclipse but it doesn't publish and when I try to run the standalone.bat file from the Bin directory it throws this error ,
JAVA_OPTS: -client -Dprogram.name=standalone.bat **-Xms1303M -Xmx1303M** -XX:MaxPe
rmSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInter
val=3600000 -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -D
jboss.modules.system.pkgs=org.jboss.byteman -Djboss.server.default.config=standa
lone.xml
**Error occurred during initialization of VM**
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
I did research the forum and many are suggesting to change the -Xms1303M to -Xms256M ., I edited the standalone.conf file in an editor but it is not getting reflected and getting the same error again.
Could someone please guide me ?
Most likely, you are using or running jboss on a 32 bit jdk and the memory params are out of range or exceed the limits of a 32 bit jdk. Either upgrade to a 64 bit jdk or add this line in your run.conf in jboss/bin, remove the jvm args from your command line and see if jboss starts.
set "JAVA_OPTS=-Xms128M -Xmx512M -XX:MaxPermSize=256M"
In Windows, it is the standalone.bat file and not the standalone.conf file that must be modified with the new JAVA_OPTS environment variable.
I'm developing web application in jsp/servlet,i had an issue with netbeans and Java. My program needs large data process. So I used -Xmx512m to increase the maximum heap size via
Tools -> Servers -> on the Platform tab there is a VM option below
Java Platform.
Then it works fine..
Now my issue is i'm building the WAR file, directly deployed and run in my another machine Tomcat for demo,
here i'm facing the same issue java out of memory error-heap space
i also tried with
environment variable set CATALINA_OPTS=-Xms512m -Xmx512m
this also didn't help me
how to resolve this issue?, Please point me to the right direction
Try to set PermSizeand MaxPermSize values and that should be set at tomcat startup in Catalina.bat and then stop and start using this script.
set CATALINA_OPTS=-server -Xms1024m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m
http://javahowto.blogspot.co.uk/2006/06/6-common-errors-in-setting-java-heap.html
Finally i found the solution for the issue
in Catalina.bat file
you can find some text like below
set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=
under that you need to put the
set CATALINA_OPTS=-Xms512m -Xmx512m
Heap size is larger than your computer's physical memory. For example,
java -Xmx2g BigApp
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
The fix is to make it lower than the physical memory: java -Xmx1g BigApp
I know I am totally late on this reply but in case it would be helpful to anybody runs into the same situation I think it worth to put a note here. I am referring to tomcat 9 so you might need to check how things mentioned here are relevant to your version:
In %CATALINA_HOME%/bin/catalina.bat, it clearly stated that:
rem WHEN RUNNING TOMCAT AS A WINDOWS SERVICE:
rem Note that the environment variables that affect the behavior of this
rem script will have no effect at all on Windows Services. As such, any
rem local customizations made in a CATALINA_BASE/bin/setenv.bat script
rem will also have no effect on Tomcat when launched as a Windows Service.
rem The configuration that controls Windows Services is stored in the Windows
rem Registry, and is most conveniently maintained using the "tomcatXw.exe"
rem maintenance utility, where "X" is the major version of Tomcat you are
rem running.
If you check your %CATALINA_HOME%/bin folder, you could find a file named like "tomcat9w.exe". Double click on it and you could see this screen shot where you can set your Xms and Xmx parameters for it to save into registry for you
Hope this helps
Out of memory error can be result of big session-timeout number in Tomcat's web.xml. In that case many web sessions can take many system memory.
I suggest you enable heap dump and analyze using IBM support Workbench (which has heap dump analyzers) and understand the problem exactly and make configurations accordingly.