Windows system Bat mode starts tomcat with Java.lang.OutOfmemoryError:PermGen Space error

Source: Internet
Author: User

1. Problem Scenario:

When you deploy a project, deploy two apps to the same Tomcat, and the console appears Java.lang.OutOfmemoryError:PermGen Space error when you start the service through Startup.bat
Server environment:
System version: Windows Server R2
Installed Memory: 64GB
Processor: 8 cores (specific models are not recorded)

2. Solution:

PermGen space: The full name is permanent Generation space, refers to the memory of the permanent storage area, this memory is mainly stored by the JVM class and meta information, class is load will be placed in the PermGen Space , which differs from the heap area where the class instance (Instance) is stored, the GC (garbage Collection) does not clean up permgen space during the main program run time, so if you have many classes in your application, you are likely to appear PermGen Space error, this error is common when the Web server pre-compile the JSP. If your web app uses a large number of third-party jars that are larger than the JVM's default size (4M), the error message appears.


Proven Workaround: Modify the contents of the Catalina.bat file, add the settings for the PermSize parameter, depending on the case:

Before modification:

REM -----Execute The requested Command--------------------------------------- Set java_opts=%java_opts%-dfile.encoding= "UTF-8"-dsun.jnu.encoding= "UTF8"-ddefault.client.encoding= "UTF-8"- duser.language=Zhset java_opts=%java_opts%-server-xms1024m-xmx1024m-xx: maxnewsize= 512m

After modification:

 rem  -----Execute the requested Command---- ----------------------------------- set  java_opts=%java_opts%- dfile.encoding= "UTF-8"-dsun.jnu.encoding= "UTF8"-ddefault.client.encoding= "UTF-8"-duser.language=zh  set  java_opts=%java_opts%-server-xms1024m-xmx1024m-xx:maxnewsize  =512m-xx:P ermsize  =256m-xx :maxpermsize  =512m 

Restart Tomccat again and start normally.


Below is a workaround for other startup methods and environments on the network for future reference

1. Eclipse Development Environment

Modify the Eclipse.ini file

-vmargs
-dosgi.requiredjavaversion=1.5
-xms128m
-xmx512m
-xx:permsize=64m
-xx:maxpermsize=128m


2. Windows Service mode starts Tomcat

Modify the Registration Form

3. Linux System

Modify catalina.sh:

Java_opts= "-xms1024m-xmx2048m-xx:permsize=256m-xx:maxpermsize=512m"

Windows system Bat mode starts tomcat with Java.lang.OutOfmemoryError:PermGen Space error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.