本文介绍了sonarRunner java.lang.OutOfMemoryError:PermGen空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 环境 1. Linux 2. Gradle 1.6 / 7 3.语言 - Java gradle clean build jacocoTestReport - 工作正常。 最近遵循SonarQube安装的文档: http://docs.sonarqube.org/display/SONAR/Running+SonarQube+as+a+Service+on+Linux (声纳开始,声纳状态,声纳停止等)。 ..commands会在这一点上起作用。 更改了gradle构建脚本到Gradle SonarRunner帮助页面: http://www.gradle。 org / docs / current / userguide / sonar_runner_plugin.html 在运行sonarRunner任务时,我收到以下错误: :sonarRunner 18:56:03.997 INFO - 加载批量设置 18:56:04.140 INFO - 用户缓存:/production/c123456/jenkins/.sonar/cache 18:56:04.146 INFO - 安装插件 18:56:04.851 INFO - 安装JDBC驱动 18:56:04.858 WARN - H2数据库应仅用于评估目的 18:56:04.858 INFO - 为jdbc创建JDBC数据源:h2:tcp://devserver11.tr.company.com:9092 / sonar 18: 56:05.870 INFO - 初始化Hibernate :sonarRunner失败 java.lang.OutOfMemoryError:PermGen空间> Building-bash-3.2 $ 在/ production / c123456 / sonar上安装声纳ie - 声纳/ conf / sonar.properties - 一切看起来正确 - sonar / conf / wrapper.properties包含JAVA opts的有效值,即 code>#Java其他参数 wrapper.java.additional.1 = -Djava.awt.headless = true wrapper.java.additional.2 = -XX:MaxPermSize = 1024m wrapper.java.additional.3 = -XX:+ HeapDumpOnOutOfMemoryError wrapper.java.additional.4 = -XX:+ CMSClassUnloadingEnabled wrapper.java.additional.5 = -XX:+ UseConcMarkSweepGC #RECOMMENDED:如果Java虚拟机是JDK但不是JRE,则取消注释。要知道使用哪个JVM,请执行#'java -version'。 JDK显示服务器VM。 wrapper.java.additional.4 = -server #初始Java堆大小(MB) wrapper.java.initmemory = 512 #最大Java堆大小(MB) wrapper.java.maxmemory = 1024 有人可以帮助我找到错误信息 - PermGen空间问题 注意:这是从一台Linux机器发生的,所以我试过在其他Linux 机器上安装Sonar仍然有相同的错误信息。 我在我自己的本地Windows机器上安装了SonarQube / Runner, .gradle sonarRunner部分使用主机url作为我的本地机器/主机url我的机器名称(fqdn)与端口(:9000)等和jdbc h2 tcp方式相同。 在运行gradle clean build jacocoTestReport sonarRunner时,它传递了上面的错误,但给了我另一个奇怪的。 C:\work是我的工作区,我已经检查了项目:Project_A_Svc(服务项目 - Java源)。 :sonarRunner失败 失败:构建失败,例外。 出了什么问题:执行失败的任务':sonarRunner'。 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多的日志输出。 BUILD FAILED 总时间:38.124秒 为什么选择Gradle 当我的源代码甚至没有该文件夹结构时,正在尝试寻找src / main / java。 Gradle默认结构是使用src / main / java作为java源代码位置,但是我的build.gradle有sourceSets部分,我已经提到了找到java源的位置。我已经尝试了多种方式为src java / tests设置源Dirs,但它仍然试图寻找src / main / java。 build.gradle snaphost 应用插件:'java'应用插件:'sonar-runner' main { java { srcDir'src / java'} } test { java { srcDir 'test / java'} } integrationTest { java { srcDir'src / java-test'} } } 和 sonarRunner部分是: def sonarServerUrl =devserver11.tr.company.com sonarRunner { sonarProperties {属性sonar.host.url,http:// $ sonarServerUrl:9000 //这些是内存中的默认设置数据库。更改如果使用持久DB。 属性sonar.jdbc.url,jdbc:h2:tcp:// $ sonarServerUrl:9092 / sonar属性sonar.jdbc.driverClassName,org.h2.Driver属性sonar.jdbc.username,sonar属性sonar.jdbc.password,sonar //属性[sonar.sources] + = sourceSets.main.java.srcDirs // properties [sonar.tests] + = sourceSets.test.java.srcDirs // ---- properties [sonar。 source] =src / java属性[sonar.tests] =test / java } } 任何帮助?非常感谢。解决方案我有一些进展。 步骤 DIDN' T改变声纳/ conf / sonar.properties中的任何东西,wrapper.properties,sonar-runner / conf / sonar-runner.properties。 MADE确保主机url值在sonar.properties和sonar-runner.properties中相同。 转到工作区(安装了源代码的位置)。 Ran sonar-runner (一个可执行文件) - 它会显示路径/文件它给出了我需要的错误,因为我在Sonar中缺少一些需要的变量。 使用链接 找到SCM提供程序未设置。使用链接: http://jira.codehaus.org/browse/ACT-1714 解决它。 再次运行声纳赛,这很好。 (注意:此命令与运行sonarRunner不同,就像Gradle的声纳运算符任务) 进入SonarQube仪表板,现在显示的内容。 PENDING for tomorrow: 在Linux命令行和Jenkins(作业调用gradle任务)中执行以下操作。 gradle clean build jacocoTestReport sonarRunner 更新: p> 尝试运行: gradle clean build jacocoTestReport - 工作 gradle clean build jacocoTestReport sonarRunner - 没有说src / main / java不存在 gradle clean build jacocoTestReport sonarRunner -Dsonar.sources = src / java - WORKED gradle clean build jacocoTestReport sonarRunner -Dsonar.sources =src / java,test / java, src / java-test - DID NOT WORKED(PermGen java错误) gradle clean build jacocoTestReport sonarRunner -Dsonar.sources =src / java - DID NOT WORKED(PermGen java错误) gradle clean build jacocoTestReport sonarRunner -Dsonar.sources = src / java - DID NOT WORKED(PermGen java error) gradle sonarRunner -Dsonar.sources = src / java,test / java,src / java-test - DID NOT WORKED(错误是charset ca没有读取或导入 - 字符集UTF-8或任何我最终设置sonar.sourceEncoding) gradle clea build jacocoTestReport 工作 然后 gradle sonarRunner -Dsonar.sources = src / java - WORKED 我已尝试将sonar / conf / wrapper.properties中的MaxPernGen设置为各种值,如128,512,1024,2048 ,...高达8000m ...没有解决以下错误 - 在一个命令中运行所有毕业任务。 :sonarRunner失败 失败:构建失败,异常。 *出了什么问题:任务执行失败:sonarRunner。 > java.lang.OutOfMemoryError:PermGen空间 *尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多的日志输出。 BUILD FAILED 想知道为什么我收到此错误一旦我运行: :gradle clean build jacocoTestReport sonarRunner 确定 - 解决了PermGen内存问题 步骤: 1.在我的〜/ .bashrc或〜/ .bash_profile中,创建了以下变量 GRADLE_OPTS =-XX:MaxPermSize = 512m 运行哪个毕业或基本上找到使用哪个毕业文件(shell或.bat)。转到该路径并打开gradle/gradle.bat(对于Windows)文件。 进行以下更改。 DEFAULT_JVM_OPTS =$ JAVA_OPTS $ GRADLE_OPTS Do。〜/ .bash_profile或。〜/ .bashrc.... - 打开一个新的putty会话。 确保PATH变量在其中具有gradle HOME / bin(Linux / Windows) 执行以下命令(此时未显示PermGen错误,我早些时候)从工作区: gradle clean build jacocoTestReport sonarRunner :) 其他类似的变量是:GRADLE_OPTS / JAVA_OPTS / SONAR_RUNNER_OPTS(其中-XX:Max ..的值可以是设置)在服务器(putty会话级别)或IDE或Jenkins中。 感谢Allyn提示。 / p> Environment:1. Linux2. Gradle 1.6/73. Language - Javagradle clean build jacocoTestReport - working fine.Recently followed the documentation provided by SonarQube installation at:http://docs.sonarqube.org/display/SONAR/Running+SonarQube+as+a+Service+on+Linux(sonar start, sonar status, sonar stop etc)...commands will work at this point.Changed gradle build script acc. to Gradle SonarRunner help page at:http://www.gradle.org/docs/current/userguide/sonar_runner_plugin.htmlWhile running sonarRunner task - I get the following error::sonarRunner18:56:03.997 INFO - Load batch settings18:56:04.140 INFO - User cache: /production/c123456/jenkins/.sonar/cache18:56:04.146 INFO - Install plugins18:56:04.851 INFO - Install JDBC driver18:56:04.858 WARN - H2 database should be used for evaluation purpose only18:56:04.858 INFO - Create JDBC datasource for jdbc:h2:tcp://devserver11.tr.company.com:9092/sonar18:56:05.870 INFO - Initializing Hibernate:sonarRunner FAILEDjava.lang.OutOfMemoryError: PermGen space> Building-bash-3.2$Installed sonar at /production/c123456/sonar i.e.- sonar/conf/sonar.properties - everything looks correct- sonar/conf/wrapper.properties - contains valid values for JAVA opts i.e. # Java Additional Parameterswrapper.java.additional.1=-Djava.awt.headless=truewrapper.java.additional.2=-XX:MaxPermSize=1024mwrapper.java.additional.3=-XX:+HeapDumpOnOutOfMemoryErrorwrapper.java.additional.4=-XX:+CMSClassUnloadingEnabledwrapper.java.additional.5=-XX:+UseConcMarkSweepGC# RECOMMENDED : uncomment if Java Virtual Machine is a JDK but not a JRE. To know which JVM you use, execute# 'java -version'. JDK displays 'Server VM'.wrapper.java.additional.4=-server# Initial Java Heap Size (in MB)wrapper.java.initmemory=512# Maximum Java Heap Size (in MB)wrapper.java.maxmemory=1024Can someone help what I could be missing to get this error message - PermGen space issueNOTE: This was happening from one Linux machine, so I tried installing Sonar on other Linux machine, still got the same error message.I installed SonarQube/Runner on my own local Windows machine and pointed build.gradle sonarRunner section to use host url as my local machine / host url my machine name (fqdn) with port (:9000) etc and same for jdbc h2 tcp way.While running "gradle clean build jacocoTestReport sonarRunner", it passes the above error but gives me another strange one. C:\work is my workspace where I have checked out the project: Project_A_Svc (service project - Java source).:sonarRunner FAILEDFAILURE: Build failed with an exception.What went wrong:Execution failed for task ':sonarRunner'.Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.BUILD FAILEDTotal time: 38.124 secsWhy Gradle is trying to look for "src/main/java" when my source code doesn't even have that folder structure. Gradle default structure is to use "src/main/java" for java source code location but my build.gradle does have sourceSets section where I have mentioned the location to find java source. I have tried multiple ways to set source Dirs for src java / tests but it's still trying to look for "src/main/java".build.gradle snapshostapply plugin: 'java'apply plugin: 'sonar-runner' main { java { srcDir 'src/java' } } test { java { srcDir 'test/java' } } integrationTest { java { srcDir 'src/java-test' } }}andsonarRunner section within build.gradle is:def sonarServerUrl = "devserver11.tr.company.com"sonarRunner { sonarProperties { property "sonar.host.url", "http://$sonarServerUrl:9000" // these are default settings for the in-memory database. Change if using a persistent DB. property "sonar.jdbc.url", "jdbc:h2:tcp://$sonarServerUrl:9092/sonar" property "sonar.jdbc.driverClassName", "org.h2.Driver" property "sonar.jdbc.username", "sonar" property "sonar.jdbc.password", "sonar" //properties ["sonar.sources"] += sourceSets.main.java.srcDirs //properties ["sonar.tests"] += sourceSets.test.java.srcDirs //---- properties["sonar.sources"] = "src/java" properties["sonar.tests"] = "test/java" }}Any help? Thanks a lot. 解决方案 I got some progress.StepsDIDN'T change anything in sonar/conf/sonar.properties, wrapper.properties, sonar-runner/conf/sonar-runner.properties. MADE sure the host url value is same in sonar.properties and sonar-runner.properties.Go to the workspace (where you have source code installed).Ransonar-runner (an executable) - it will show the path/fileIt gave the error that I need sonar-project.properties as I was missing some variables requiredby Sonar.Used the linkFound SCM Provider not set. Used the link: http://jira.codehaus.org/browse/ACT-1714 to resolve it.ran sonar-runner again, it went fine. (NOTE: This command is different than running sonarRunner as that's Gradle's sonar runner task).Went to SonarQube dashboard and there's stuff showing now.PENDING for tomorrow:To the following at Linux command line and from Jenkins (job calling gradle tasks).gradle clean build jacocoTestReport sonarRunnerUpdate:Tried running:gradle clean build jacocoTestReport - worksgradle clean build jacocoTestReport sonarRunner -- Fails saying src/main/java doesn't existgradle clean build jacocoTestReport sonarRunner -Dsonar.sources=src/java -- WORKEDgradle clean build jacocoTestReport sonarRunner -Dsonar.sources="src/java,test/java,src/java-test" -- DID NOT WORKED (PermGen java error)gradle clean build jacocoTestReport sonarRunner -Dsonar.sources="src/java" -- DID NOT WORKED (PermGen java error)gradle clean build jacocoTestReport sonarRunner -Dsonar.sources=src/java -- DID NOT WORKED (PermGen java error)gradle sonarRunner -Dsonar.sources=src/java,test/java,src/java-test -- DID NOT WORKED (Error is charset can't read or import - charset UTF-8 or whatever I end up setting for sonar.sourceEncoding)gradle clea build jacocoTestReport -- WORKEDthengradle sonarRunner -Dsonar.sources="src/java" -- WORKEDI have tried setting MaxPernGen in sonar/conf/wrapper.properties to various values like 128, 512, 1024, 2048, ... upto 8000m ... didn't work in resolving the following error - while running all gradle tasks in one command.:sonarRunner FAILEDFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':sonarRunner'.> java.lang.OutOfMemoryError: PermGen space* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.BUILD FAILEDWondering why I'm getting this error as soon as I run::gradle clean build jacocoTestReport sonarRunner"OK - got PermGen Memory issue resolved.Steps:1. In my ~/.bashrc or ~/.bash_profile. I created the following variableGRADLE_OPTS=" -XX:MaxPermSize=512m"Run "which gradle" or basically find which gradle file (shell or .bat) is used. Go to that path and open "gradle" / "gradle.bat" (for windows) file.Make the following changes.DEFAULT_JVM_OPTS="$JAVA_OPTS $GRADLE_OPTS"Do ". ~/.bash_profile" or ". ~/.bashrc" .... --OR open a new putty session.Make sure PATH variable has gradle HOME / bin in it (Linux/Windows)Ran the following command (this time didn't show PermGen error which I got earlier) from workspace:gradle clean build jacocoTestReport sonarRunner:) Time to go home early today.Other similar variables are: GRADLE_OPTS / JAVA_OPTS / SONAR_RUNNER_OPTS (where -XX:Max.. value can be set) at server(putty session level) or in IDEs or in Jenkins.Thanks Allyn for the hint. 这篇关于sonarRunner java.lang.OutOfMemoryError:PermGen空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-07 13:46