当前位置: 首页 > 面试题库 >

Jenkins-java.lang.OutOfMemoryError:PermGen空间-

吕德惠
2023-03-14
问题内容

环境:Linux / Windows7,Java 1.6.0.03/37或1.7

我下载了jenkins.war,并使用以下脚本/命令进行了初始设置后,我下载了一些插件(10-15),并尝试重新启动Jenkins,它起作用了。然后,我得到了更多的插件(总共30-40个),选择了Install或download
+ then + install,Jenkins却没有出现。

即使用startJenkins.sh(仅Linux)。注意:在Windows7上,Jenkins作为Windows服务启动。

#!/bin/bash
export JAVA_HOME=/production/jenkinsAKS/java/jdk1.6.0_03
export JENKINS_HOME=/production/jenkinsAKS
export PATH=${JAVA_HOME}/bin:${PATH}
export JENKINS_HTTP_PORT=9040
export JENKINS_AJP13_PORT=9949
now=`date +%Y%m%d_%H%M%S`

echo  $0 begins ${now}
echo "   java-home=${JAVA_HOME}, jenkins-home=${JENKINS_HOME}, path=${PATH}"
java -jar ${JENKINS_HOME}/lib/jenkins.war -XX:MaxPermSize=4096m --logfile=${JENKINS_HOME}/log/jenkins.log${now} --httpPort=${JENKINS_HTTP_PORT} --ajp13Port=${JENKINS_AJP13_PORT} &

最初,我没有使用“ -XX:MaxPermSize = 4096m”参数,但是当我看到以下错误消息时,便尝试了各种值,例如128/512 /
1024、2048、4096m等,对错误没有帮助。

INFO: Beginning extraction from war file
Jenkins home directory: /production/jenkinsAKS found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Aug 1, 2013 1:17:15 PM winstone.Logger logInternal
INFO: HTTP Listener started: port=9040
Aug 1, 2013 1:17:15 PM winstone.Logger logInternal
INFO: AJP13 Listener started: port=9949
Aug 1, 2013 1:17:15 PM winstone.Logger logInternal
INFO: Winstone Servlet Engine v0.9.10 running: controlPort=disabled
Aug 1, 2013 1:17:16 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Aug 1, 2013 1:17:16 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Aug 1, 2013 1:17:16 PM hudson.plugins.ansicolor.PluginImpl start
INFO: AnsiColor: eliminating boring output (https://github.com/dblock/jenkins-ansicolor-plugin)
Aug 1, 2013 1:17:16 PM org.jvnet.hudson.plugins.backup.BackupPluginImpl loadConfiguration
INFO: Loading configuration...
Aug 1, 2013 1:17:16 PM org.jvnet.hudson.plugins.backup.utils.BackupPersistence loadConfig
INFO: Config file not found.
Aug 1, 2013 1:17:18 PM ruby.RubyRuntimePlugin start
INFO: Injecting JRuby into XStream
Trying to load models from /production/jenkinsAKS/plugins/pathignore/WEB-INF/classes/models
Loading /production/jenkinsAKS/plugins/pathignore/WEB-INF/classes/models/pathignore_wrapper.rb
Aug 1, 2013 1:17:26 PM hudson.plugins.greenballs.PluginImpl start
INFO: Green Balls!
Aug 1, 2013 1:17:26 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Aug 1, 2013 1:17:32 PM hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1 error
WARNING: Failed to instantiate optional component org.jfrog.hudson.ivy.ArtifactoryIvyConfigurator$DescriptorImpl; skipping
Aug 1, 2013 1:17:32 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Aug 1, 2013 1:17:32 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Aug 1, 2013 1:17:32 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Aug 1, 2013 1:17:32 PM hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness queueChangeSet
INFO: Queue of changeset     A hudson.model.UpdateCenter.xml
 aborted (scm manipulator not settled !)
Aug 1, 2013 1:17:32 PM org.jenkinsci.main.modules.sshd.SSHD start
INFO: Started SSHD at port 36227
Aug 1, 2013 1:17:32 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Aug 1, 2013 1:17:32 PM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 46056
The following triggers are available for your jobs
[Trigger] - Build periodically
[Trigger] - Build when another project is promoted
[Trigger] - Maven Dependency Update Trigger
[Trigger] - Poll SCM
[Trigger] - [BuildResultTrigger] - Monitor build results of other jobs
[Trigger] - [FSTrigger] - Monitor files
[Trigger] - [FSTrigger] - Monitor folder
[Trigger] - [IvyTrigger] - Poll with an Ivy script
[Trigger] - [ScriptTrigger] - Poll with a Groovy script
[Trigger] - [ScriptTrigger] - Poll with a shell or batch script
[Trigger] - [URLTrigger] - Poll with a URL
Aug 1, 2013 1:17:33 PM hudson.WebAppMain$2 run
INFO: Jenkins is fully up and running
Exception in thread "Jenkins cron thread" java.lang.OutOfMemoryError: PermGen space
Exception in thread "JmDNS(sagrdev3sb12.local.).State.Timer" java.lang.OutOfMemoryError: PermGen space
Exception in thread "ConnectorThread:[http-9040]" java.lang.OutOfMemoryError: PermGen space
Exception in thread "JmDNS(sagrdev3sb12.local.).Timer" java.lang.OutOfMemoryError: PermGen space
Exception in thread "WinstoneHostConfigurationMgmt:default" java.lang.OutOfMemoryError: PermGen space

或有时我看到:

    30  Aug 1, 2013 1:50:29 AM jenkins.InitReactorRunner$1 onAttained
    31  INFO: Prepared all plugins
    32  Exception in thread "pool-2-thread-20" java.lang.OutOfMemoryError: PermGen space
    33  Aug 1, 2013 1:51:10 AM winstone.Logger logInternal
    34  WARNING: Untrapped Error in Servlet
    35  java.lang.OutOfMemoryError: PermGen space
    36  Aug 1, 2013 1:51:12 AM winstone.Logger logInternal
    37  SEVERE: Error in the error servlet
    38  java.lang.OutOfMemoryError: PermGen space
    39  Exception in thread "Jenkins cron thread" java.lang.OutOfMemoryError: PermGen space
-bash-3.2$

我该如何解决这个问题?当我在Windows台式机上进行相同的练习时,也会出现相同的问题。我需要使用更少或数量有限的插件吗?

谢谢


问题答案:

在〜/
.bash_profile文件中,我设置了以下3个变量。请注意,此文件中还有其他变量,例如JAVA_HOME,ANT_HOME,SONAR_HOME,SONAR_RUNNER_HOME等:

export JAVA_OPTS="-XX:MaxPermSize=512m -Xms512m -Xmx1024m"
export GRADLE_OPTS="-XX:MaxPermSize=512m"
export SONAR_RUNNER_OPTS="-Xmx512m -XX:MaxPermSize=512m"

全部-现在工作。

The first export line: will get Jenkins going without PermGen error, the 2nd
line will make Gradle going when Jenkins calls Gradle script (via a another
wrapper script for ex. .sh/etc), third line makes “sonar-runner” command to
work fine (otherwise, I was getting an error for PermGen after “Initialize
Hibernate”… line during sonar-runner command’s output). You run sonar-runner
command in the workspace where you have compiled java, reports related to
static code analysis tools (pmd/checkstyle/findbugs) and other code coverage
reports (jacoco/cobertura). Workspace should have “sonar-project.properties”
file. Look for SonarQube help pages about this file and what all variables it
contains for a project.

所有这些选项都记录在这里: http
:
//docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html;
如果使用的是Java 7,则在这里记录:
http
//docs.oracle.com
/javase/7/docs/technotes/tools/windows/java.html


 类似资料:
  • 问题内容: 我收到以下错误“ http-9000-5” java.lang.OutOfMemoryError:PermGen空间 org.apache.catalina.core.ApplicationDispatcher调用SEVERE:Servlet jsp的Servlet.service()抛出异常java.lang.OutOfMemoryError:PermGen空间。 我的应用程序使用a

  • 问题内容: 我收到此异常。我正在使用Eclipse Juno和Tomcat 7.0。在控制台中,每10-15分钟至少发生一次此异常。怎么解决呢? 问题答案: 与其在eclipse.ini中进行更改,不如安装Java 8 。 我安装了Java 8,但现在没有异常。

  • 类似的问题是存在的,但没有一个答案受到关注.. 这里说“解决这个问题的一个方法是JDBC驱动程序由通用类加载器而不是应用程序类加载器加载,你可以通过将驱动程序的jar文件转移到tomcat lib中,而不是捆绑在web应用程序的war文件中 不明白通过通用类加载器加载意味着什么,它与应用程序类加载器有什么不同。

  • 问题内容: 我在构建Maven项目时遇到此错误,我增加了MAVEN_OPTS,但同样,发现了一些类似的帖子,但它们引用的是其他内容。我该如何解决? 我不担心如何 在Maven生态系统中 进行修复 __ 问题答案: 当您说增加时,您增加了什么价值?您是否增加了,例如: (或在Windows上:)

  • 我有一个项目,我使用Jacoco计算代码覆盖率。我使用maven配置,如下所示: http://www.petrikainulainen.net/programming/maven/creating-code-coverage-reports-for-unit-and-integration-tests-with-the-jacoco-maven-plugin/ 我和詹金斯一起运行“mvn清洁安装

  • 问题内容: 我是Jenkins / Hudson的新手,正在尝试从buildbot迁移基于C make的项目。由于遗留原因,构建系统被硬编码以在版本控制的源代码树(git)之外(在上面的一个目录中)在单独的目录中进行构建。例如: 除了最终在工作空间之外创建目录这一事实外,Jenkins不会识别上面build /目录中的项目以将其归档为工件。 如何使这种构建系统与Hudson一起使用?在源代码树中构