在http://www.cnblogs.com/wql025/p/4865673.html一文中我曾描述這種異常也提供瞭解決方式,但效果不太理想,如今用本文的方式,效果顯著。html
目前此項目只能登陸,再打開其餘功能模塊即出現如下異常:java
Exception in thread "http-bio-8081-exec-3" java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.decodeLocalVariableAttribute(MethodInfo.java:529)
at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.decodeCodeAttribute(MethodInfo.java:511)
at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.readCodeAttribute(MethodInfo.java:482)
at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.getArgumentNames(MethodInfo.java:251)
at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.initialize(MethodInfo.java:349)
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.initialize(ClassFileReader.java:1153)
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:388)
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:231)
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:203)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:157)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:201)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2982)
at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:97)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:472)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:571)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:567)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType(TypeReference.java:541)
at org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype(ClassScope.java:1287)
at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperclass(ClassScope.java:938)
at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1095)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:323)spring
從名字能夠看出此異常是內存溢出。以前遇到好屢次,解決的方案可能是增長Tomcat內存,但效果幾乎都不理想,今天沒有動Tomcat,只是增長了eclipse的內存,此方案出自http://bbs.csdn.net/topics/390961799中magi1201網友的留言。apache
下面是個人解決步驟:tomcat
一、先在eclipse安裝目錄中將eclipse的啓動參數調大一些--在eclipse的安裝目錄的ini文件,我用的是STS,因此是STS.ini文件。eclipse
原文件參數:ide
-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417 -product org.springsource.sts.ide --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -vmargs -Dosgi.requiredJavaVersion=1.7 -Xms40m -XX:MaxPermSize=256m -Xverify:none -Dorg.eclipse.swt.browser.IEVersion=10001 -Xmx1200m
調整後的文件參數:字體
-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417 -product org.springsource.sts.ide --launcher.defaultAction openFile --launcher.XXMaxPermSize 512M -vmargs -Dosgi.requiredJavaVersion=1.7 -Xms40m -XX:MaxPermSize=512m -Xverify:none -Dorg.eclipse.swt.browser.IEVersion=10001 -Xmx1200m
注:紅色字體爲修改參數ui
二、而後在eclipse的server欄,找到tomcat選項,打開tomcat的配置spa
2.1
2.2
2.3
在arguments 標籤框下面的VM Arguments 框後面接上本身的tomcat啓動虛擬機參數就能夠了。注:紅色線標註的爲新增內容。記得點Apply和OK哦
後記:此方法一試就靈,原來本項目的內存只夠登陸,再點擊別的功能均出現此異常,安裝上面的方法進行修改後當即恢復正常。可是最重要的考驗是在運行狀況下修改項目--待考驗...