Reputation: 661
Ok so I recently moved to a new Computer with a fresh install of Win7 Pro
I copied across all my old files and folders from my old PC
I copied my Tomcat 7 file to the new PC
But now when I try and start it I get this error
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "http-bio-8080-exec-2"
I've looked EVERYWHERE for a solution to this and found hundreds of different ones but none helped me
Any ideas what could cause this error ? (I'm using the exact same tomcat file copied from old PC and exact same project that still works on old PC)
NOTE:
I've set the environmental variables exactly like they were on my old Computer.
I'm using the exact same webapp I've been using for ages on my previous PC (So It cant be a memory leak or something wrong with the project)
Upvotes: 6
Views: 37656
Reputation: 1318
I was able to use the suggestions here to debug a problem I was having with Travis CI running out of memory while running Eclipse plugin unit tests. I had to set the MaxPermSize, which I did by adding the following to my java ant task:
<jvmarg line="-Xms40m -Xmx1024m -XX:MaxPermSize=512m"/>
Upvotes: 0
Reputation: 1
After many searchs, I found this solution. It worked correctly.
set JAVA_OPTS=%JAVA_OPTS%” with “set JAVA_OPTS=-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m” in "setenv" batch file which will be in the following path
\jasperreports-server-cp-5.6.0\apache-tomcat\bin
Upvotes: 0
Reputation: 149
I sorted out the same problem by only adding following line in to catalina.bat in windows 7 tomcat 7.
set JAVA_OPTS =" -XX:PermSize=512m -XX:MaxPermSize=1024m"
I had 4 GB RAM.
Upvotes: 1
Reputation: 8928
I got the same error message, although from other sources on the web the error message may occur due to running out of heap space, and not just due to running out of permgen space.
I needed to fix this from the command line instead of using a graphical interface. To do that, I added a new file at <tomcat install directory>/bin/setenv.sh
with the contents:
CATALINA_OPTS="-Xms4096M -Xmx4096M -XX:PermSize=512M -XX:MaxPermSize=512M"
If you have an existing setenv.sh
file, add this to that file. Use whatever numbers are appropriate to your installation - my server has 96GB of memory so I can afford 4GB for Tomcat.
As documented in catalina.sh
, you should add this to setenv.sh
instead of to catalina.sh
so as to keep this local modification separate from the base catalina.sh
script. You should change CATALINA_OPTS
instead of JAVA_OPTS
so as to require the larger amount of memory only for the actual Tomcat server; changing JAVA_OPTS
will require the memory for the shutdown process as well, which may interfere with shutdown of the server if the system's memory is running low.
Upvotes: 8
Reputation: 661
I finally found the answer:
Go to your tomcat bin folder
run "tomcat7w.exe" as Admin
Add this to the java options in the Java tab
-Xms3072M
-Xmx6144M
-XX:PermSize=512m
-XX:MaxPermSize=1024m
For more info check this link
http://community.jaspersoft.com/wiki/configuring-tomcats-java-heap-size
Upvotes: 4
Reputation: 3822
You can assign those into JAVA_OPTS
variable which is located inside of catalina.sh
(tomcatPath/bin):
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"
Another possibility is there can be memory leak. You can check here to troubleshooting memory leaks.
Upvotes: 0