如果对该问题的回复对我有帮助,那么这可能是Installing Sonar and Jenkins on Tomcat的重复。
唉,我已将CATALINA_OPTS
设置为-Dfile.encoding=UTF-8 -server -Xmx2560m -XX:MaxPermSize=1024m
,这远远高于上述帖子中推荐的值,我仍然会收到 OutOfMemoryException:PermGen space 消息。
我必须补充说,在从-Xmx1536m
和-XX:MaxPermSize=256m
跳过256米步后,我得到了这些值。
我确信tomcat7进程看到了这个环境设置 - ProcessExplorer确认它是可见的。
我使用Java 6作为Windows服务运行tomcat 7,Win2008R2 64位,内存为8GB。 Tomcat是唯一运行的重型进程 - 可用RAM。
问题肯定是Sonar(我已经下载了2.12),因为在我将Sonar部署到Tomcat之后,这个问题就出现了。
如何解决此问题?它让我很生气。
感谢。
修改
这是最新的tomcat7-stderr.2011-12-21.log:
2011-12-21 14:27:02 Commons Daemon procrun stderr initialized
21/12/2011 14:27:03 org.apache.catalina.core.AprLifecycleListener init
INFO: An older version 1.1.20 of the APR based Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of 1.1.22
21/12/2011 14:27:03 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.20.
21/12/2011 14:27:03 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
21/12/2011 14:27:03 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
21/12/2011 14:27:03 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
21/12/2011 14:27:03 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 720 ms
21/12/2011 14:27:03 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
21/12/2011 14:27:03 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.20
21/12/2011 14:27:03 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive jenkins.war
21/12/2011 14:27:04 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive sonar.war
21/12/2011 14:27:04 jenkins.model.Jenkins$6 onAttained
INFO: Started initialization
21/12/2011 14:27:04 jenkins.model.Jenkins$6 onAttained
INFO: Listed all plugins
21/12/2011 14:27:05 jenkins.model.Jenkins$6 onAttained
INFO: Prepared all plugins
21/12/2011 14:27:05 jenkins.model.Jenkins$6 onAttained
INFO: Started all plugins
21/12/2011 14:27:05 jenkins.model.Jenkins$6 onAttained
INFO: Augmented all extensions
21/12/2011 14:27:07 jenkins.model.Jenkins$6 onAttained
INFO: Loaded all jobs
21/12/2011 14:27:07 jenkins.model.Jenkins$6 onAttained
INFO: Completed initialization
21/12/2011 14:27:07 hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 60830
21/12/2011 14:27:18 hudson.slaves.SlaveComputer tryReconnect
INFO: Attempting to reconnect vm-builder
21/12/2011 14:27:18 hudson.WebAppMain$2 run
INFO: Jenkins is fully up and running
java.lang.OutOfMemoryError: PermGen space
at java.lang.Throwable.getStackTraceElement(Native Method)
at java.lang.Throwable.getOurStackTrace(Throwable.java:591)
at java.lang.Throwable.printStackTraceAsCause(Throwable.java:529)
at java.lang.Throwable.printStackTraceAsCause(Throwable.java:545)
at java.lang.Throwable.printStackTraceAsCause(Throwable.java:545)
at java.lang.Throwable.printStackTrace(Throwable.java:516)
at java.util.logging.SimpleFormatter.format(SimpleFormatter.java:72)
at org.apache.juli.FileHandler.publish(FileHandler.java:200)
at java.util.logging.Logger.log(Logger.java:481)
at java.util.logging.Logger.doLog(Logger.java:503)
at java.util.logging.Logger.logp(Logger.java:703)
at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:185)
at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:151)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:815)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:932)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:723)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:389)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:334)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
这是最新的catalina.2011-12-21.log:
21/12/2011 14:27:03 org.apache.catalina.core.AprLifecycleListener init
INFO: An older version 1.1.20 of the APR based Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of 1.1.22
21/12/2011 14:27:03 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.20.
21/12/2011 14:27:03 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
21/12/2011 14:27:03 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
21/12/2011 14:27:03 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
21/12/2011 14:27:03 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 720 ms
21/12/2011 14:27:03 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
21/12/2011 14:27:03 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.20
21/12/2011 14:27:03 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive jenkins.war
21/12/2011 14:27:04 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive sonar.war
21/12/2011 14:27:04 jenkins.model.Jenkins$6 onAttained
INFO: Started initialization
21/12/2011 14:27:04 jenkins.model.Jenkins$6 onAttained
INFO: Listed all plugins
21/12/2011 14:27:05 jenkins.model.Jenkins$6 onAttained
INFO: Prepared all plugins
21/12/2011 14:27:05 jenkins.model.Jenkins$6 onAttained
INFO: Started all plugins
21/12/2011 14:27:05 jenkins.model.Jenkins$6 onAttained
INFO: Augmented all extensions
21/12/2011 14:27:07 jenkins.model.Jenkins$6 onAttained
INFO: Loaded all jobs
21/12/2011 14:27:07 jenkins.model.Jenkins$6 onAttained
INFO: Completed initialization
21/12/2011 14:27:07 hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 60830
21/12/2011 14:27:18 hudson.slaves.SlaveComputer tryReconnect
INFO: Attempting to reconnect vm-builder
21/12/2011 14:27:18 hudson.WebAppMain$2 run
INFO: Jenkins is fully up and running
commons-daemon.2011-12-21.log和localhost.2011-12-21.log都不包含任何错误。
以下是各自的sonar.log:
2011.12.21 14:27:16 INFO o.s.p.Database Create JDBC datasource
2011.12.21 14:27:17 INFO org.sonar.INFO Initializing Hibernate
2011.12.21 14:27:18 INFO org.sonar.INFO Start services...
2011.12.21 14:27:18 INFO org.sonar.INFO Sonar home: C:\sonar-2.12
2011.12.21 14:27:18 INFO org.sonar.INFO Deploy dir: C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp\0-sonar\deploy
2011.12.21 14:27:18 INFO org.sonar.INFO Install plugins...
2011.12.21 14:27:18 INFO org.sonar.INFO Install plugins done: 514 ms
2011.12.21 14:27:19 INFO org.sonar.INFO Notification service started (delay 60 sec.)
2011.12.21 14:27:19 INFO org.sonar.INFO Deploy GWT plugins...
2011.12.21 14:27:19 INFO org.sonar.INFO publish org.sonar.plugins.core.testdetailsviewer.TestsViewer to C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp\0-sonar\deploy\gwt
2011.12.21 14:27:20 INFO org.sonar.INFO publish org.sonar.plugins.core.hotspots.GwtHotspots to C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp\0-sonar\deploy\gwt
2011.12.21 14:27:20 INFO org.sonar.INFO publish org.sonar.plugins.design.ui.libraries.LibrariesPage to C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp\0-sonar\deploy\gwt
2011.12.21 14:27:20 INFO org.sonar.INFO publish org.sonar.plugins.design.ui.page.DesignPage to C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp\0-sonar\deploy\gwt
2011.12.21 14:27:21 INFO org.sonar.INFO publish org.sonar.plugins.design.ui.dependencies.DependenciesTab to C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp\0-sonar\deploy\gwt
2011.12.21 14:27:21 INFO org.sonar.INFO publish org.sonar.plugins.design.ui.lcom4.Lcom4Tab to C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp\0-sonar\deploy\gwt
2011.12.21 14:27:21 INFO org.sonar.INFO Deploy GWT plugins done: 1794 ms
2011.12.21 14:27:21 INFO org.sonar.INFO Load metrics...
2011.12.21 14:27:22 INFO org.sonar.INFO cleaning alert thresholds...
2011.12.21 14:27:22 INFO org.sonar.INFO Load metrics done: 765 ms
2011.12.21 14:27:22 INFO org.sonar.INFO Register rules [findbugs/java]...
2011.12.21 14:27:22 INFO org.sonar.INFO 384 rules
2011.12.21 14:27:23 INFO org.sonar.INFO Register rules [findbugs/java] done: 624 ms
2011.12.21 14:27:23 INFO org.sonar.INFO Register rules [checkstyle/java]...
2011.12.21 14:27:23 INFO org.sonar.INFO 122 rules
2011.12.21 14:27:23 INFO org.sonar.INFO Register rules [checkstyle/java] done: 296 ms
2011.12.21 14:27:23 INFO org.sonar.INFO Register rules [pmd/java]...
2011.12.21 14:27:23 INFO org.sonar.INFO 224 rules
2011.12.21 14:27:23 INFO org.sonar.INFO Register rules [pmd/java] done: 328 ms
2011.12.21 14:27:23 INFO org.sonar.INFO Register rules [squid/java]...
2011.12.21 14:27:23 INFO org.sonar.INFO 12 rules
2011.12.21 14:27:23 INFO org.sonar.INFO Register rules [squid/java] done: 124 ms
2011.12.21 14:27:23 INFO org.sonar.INFO Disable deprecated user rules...
2011.12.21 14:27:23 INFO org.sonar.INFO Disable deprecated user rules done: 94 ms
2011.12.21 14:27:23 INFO org.sonar.INFO Load provided profiles...
2011.12.21 14:27:26 INFO org.sonar.INFO Clean provided profiles...
2011.12.21 14:27:27 INFO org.sonar.INFO Clean provided profiles done: 575 ms
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sonar way with Findbugs,language=java]...
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sonar way with Findbugs,language=java] done: 548 ms
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sonar way,language=java]...
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sonar way,language=java] done: 80 ms
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sun checks,language=java]...
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sun checks,language=java] done: 120 ms
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sonar way with Findbugs,language=java]...
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sonar way with Findbugs,language=java] done: 62 ms
2011.12.21 14:27:27 INFO org.sonar.INFO Save profile [name=Sonar way,language=java]...
2011.12.21 14:27:28 INFO org.sonar.INFO Save profile [name=Sonar way,language=java] done: 147 ms
2011.12.21 14:27:28 INFO org.sonar.INFO Save profile [name=Sonar way with Findbugs,language=java]...
2011.12.21 14:27:28 INFO org.sonar.INFO Save profile [name=Sonar way with Findbugs,language=java] done: 69 ms
2011.12.21 14:27:28 INFO org.sonar.INFO Save profile [name=Sun checks,language=java]...
2011.12.21 14:27:28 INFO org.sonar.INFO Save profile [name=Sun checks,language=java] done: 21 ms
2011.12.21 14:27:28 INFO org.sonar.INFO Load provided profiles done: 4332 ms
2011.12.21 14:27:28 INFO org.sonar.INFO Enable profiles...
2011.12.21 14:27:28 INFO org.sonar.INFO Enable profiles done: 12 ms
2011.12.21 14:27:28 INFO org.sonar.INFO Activate default profile for java
2011.12.21 14:27:28 INFO org.sonar.INFO Register quality models...
2011.12.21 14:27:28 INFO org.sonar.INFO Register quality models done: 0 ms
2011.12.21 14:27:28 INFO org.sonar.INFO Start services done: 9958 ms
答案 0 :(得分:1)
尝试将此添加到Tomcat命令行:
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
答案 1 :(得分:0)
答案由prunge中的How to pass a system property to a web application hosted in Tomcat 7 running as a Windows Service?给出 - 由于未知原因,tomcat Windows Service期望在注册表中找到JVM参数。