2012-12-14 107 views
3

我試圖做聲納2.11代碼分析,使用maven 3.無法執行FindBugs的:java.lang.OutOfMemoryError:Java堆空間,同時運行MVN聲納:聲納-X

我面對這錯誤

java.lang.OutOfMemoryError: Java heap space

我試圖增加MAVEN_OPTS到-Xmx1024m -Xms512m -XX:MaxPermSize=256m但沒用。

該項目大小約900MB。我在maven 3中使用命令mvn sonar:sonar -X。但構建失敗。 我沒有運行測試,也沒有在superPOM中使用任何surefire插件。所以我無法找到問題的原因。 請幫我弄清楚問題出在哪裏。 在此先感謝... 這裏是日誌...

[INFO] ------------------------------------------------------------------------ 
[INFO] Reactor Summary: 
[INFO] 
[INFO] PHOENIX JAVA MODULE COMPONENT ..................... SKIPPED 
[INFO] PHOENIX JAVA COMPONENT ............................ FAILURE [1:27:23.969s] 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1:27:26.229s 
[INFO] Finished at: Fri Dec 14 14:14:24 IST 2012 
[INFO] Final Memory: 287M/1016M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project XXX: Can not execute Sonar: Can not execute Findbugs: java.lang.OutOfMemoryError: Java heap space -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project XXX: Can not execute Sonar 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar 
    at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118) 
    at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65) 
    at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    ... 19 more 
Caused by: org.sonar.api.utils.SonarException: Can not execute Findbugs 
    at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:120) 
    at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:58) 
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64) 
    at org.sonar.batch.phases.Phases.execute(Phases.java:93) 
    at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143) 
    at org.sonar.batch.bootstrap.Module.start(Module.java:89) 
    at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:110) 
    at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:105) 
    at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:100) 
    at org.sonar.batch.bootstrap.Module.start(Module.java:89) 
    at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:96) 
    at org.sonar.batch.bootstrap.Module.start(Module.java:89) 
    at org.sonar.batch.Batch.execute(Batch.java:74) 
    at org.sonar.maven3.SonarMojo.executeBatch(SonarMojo.java:147) 
    at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:136) 
    at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113) 
    ... 23 more 
Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space 
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232) 
    at java.util.concurrent.FutureTask.get(FutureTask.java:91) 
    at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:112) 
    ... 38 more 
Caused by: java.lang.OutOfMemoryError: Java heap space 
    at java.util.ArrayList.<init>(ArrayList.java:112) 
    at edu.umd.cs.findbugs.ba.Frame.<init>(Frame.java:110) 
    at edu.umd.cs.findbugs.ba.vna.ValueNumberFrame.<init>(ValueNumberFrame.java:58) 
    at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.createFact(ValueNumberAnalysis.java:148) 
    at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.createFact(ValueNumberAnalysis.java:55) 
    at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:309) 
    at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:72) 
    at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:47) 
    at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:332) 
    at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:282) 
    at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysis(ClassContext.java:942) 
    at edu.umd.cs.findbugs.ba.ClassContext.getValueNumberDataflow(ClassContext.java:361) 
    at edu.umd.cs.findbugs.detect.FindInconsistentSync2.findObviouslyLockedCallSites(FindInconsistentSync2.java:963) 
    at edu.umd.cs.findbugs.detect.FindInconsistentSync2.visitClassContext(FindInconsistentSync2.java:311) 
    at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:68) 
    at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:979) 
    at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:230) 
    at org.sonar.plugins.findbugs.FindbugsExecutor$FindbugsTask.call(FindbugsExecutor.java:137) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:619) 
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command 
[ERROR] mvn <goals> -rf :XXX 
+0

'mvn findbugs:findbugs'給你什麼?以及你需要在http://mojo.codehaus.org/findbugs-maven-plugin/findbugs-mojo.html#jvmArgs上設置permgen來使'findbugs:findbugs'工作。我懷疑有一些神奇的祕密聲納配置是相當的(如果它不只是委託給'findbugs:findbugs',否則你將需要提高聲納bug「 –

+0

@StephenConnolly當我運行'mvn findbugs:findbugs'編譯失敗,出現此錯誤執行目標org.codehaus.mojo的默認cli:findbugs-maven-plugin:2.5.2:findbugs失敗:Java返回:1' – 304751

+0

因此,現在嘗試改變它的配置與forkMode真正的,增加內存(最有可能只是permgen),直到它不會崩潰,這將告訴你有多少內存找到錯誤需要*沒有聲納在混合中......然後,你可以調整聲納,一旦你有這個答案 –

回答

1

這是一個衆所周知的問題:FindBugs的是真正的內存餓了,所以我並不感到驚訝,有900MB的項目,你有以增加JVM內存選項。

3件事情可以做:

  1. 再次增加JVM內存選項,直到它是OK

  2. 減少你的聲納質量配置文件

  3. 重構的激活FindBugs的規則量您的項目是較小的模塊,以便每個模塊需要較少的內存才能通過Findbugs進行分析

如果我是你,我至少會選擇#3,因爲單個項目的900MB真的很大。

+0

我的想法。選項3是唯一的選擇,當然你也可以投入硬件。 – SSR

+0

@Fabrice 1)我試圖增加超過1GB的JVM內存,此後JVM本身未能初始化。該項目由幾個模塊組成,但我怎樣才能配置我需要在pom.xml中安裝哪個模塊?可以請你簡要解釋一下如何設置要在pom.xml中分析的源代碼目錄? – 304751

+0

另一個疑問是,是否運行eclipse並行到maven構建過程導致outofmemory錯誤或java堆空間錯誤...? – 304751

0

我有類似的問題,它用來掛在Journal Flushing上,並最終超時,無論我在Findar Java默認超時聲吶中設置的值是多少,還是發生內存不足錯誤。

我解決了這個使用下列選項,同時運行的聲納Maven的命令: - MAVEN_OPTS = 「 - Xms256m -Xmx4096m -XX:+ UseSerialGC」

這已經解決了該問題對我來說。

這個帖子幫了我: - http://sonarqube-archive.15.x6.nabble.com/SonarQube-terminates-at-quot-Journal-Flusher-quot-warning-and-heap-size-error-td5027066.html

相關問題