I am analysing a large project in Sonar and getting following error,
00:41:48.325 INFO - Base dir: C:\Users\Administrator\Desktop\sonar-runner-dist-2.4\sonar-runner-2.4\bin\.
00:41:48.325 INFO - Working dir: C:\Users\Administrator\Desktop\sonar-runner-dist-2.4\sonar-runner-2.4\bin\.\.sonar
00:41:48.325 INFO - Source encoding: UTF-8, default locale: en_US
00:41:48.325 INFO - Quality profile for java: PMD
00:41:48.332 INFO - Sensor QProfileSensor...
00:41:48.336 INFO - Sensor QProfileSensor done: 4 ms
00:41:48.336 INFO - Sensor CpdSensor...
00:41:48.336 INFO - SonarEngine is used for java
00:41:48.336 INFO - Sensor CpdSensor done: 0 ms
00:41:48.336 INFO - Sensor InitialOpenIssuesSensor...
00:41:48.486 INFO - Sensor InitialOpenIssuesSensor done: 150 ms
00:41:48.486 INFO - Sensor ProfileEventsSensor...
00:41:48.602 INFO - Sensor ProfileEventsSensor done: 116 ms
00:41:48.603 INFO - Sensor ProjectLinksSensor...
00:41:48.605 INFO - Sensor ProjectLinksSensor done: 2 ms
00:41:48.606 INFO - Sensor VersionEventsSensor...
00:41:48.631 INFO - Sensor VersionEventsSensor done: 26 ms
00:41:48.631 INFO - Sensor FileHashSensor...
00:41:48.631 INFO - Sensor FileHashSensor done: 0 ms
00:41:48.794 INFO - Execute decorators...
00:41:49.256 INFO - Store results in database
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1:19:23.133s
Final Memory: 11M/494M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:2694)
at java.lang.String.<init>(String.java:203)
at java.lang.StringBuilder.toString(StringBuilder.java:405)
at com.persistit.Value.get(Value.java:2143)
at com.persistit.DefaultValueCoder$ObjectFieldAccessor.fromValue(DefaultValueCoder.java:560)
at com.persistit.DefaultValueCoder.renderDefaultFields(DefaultValueCoder.java:1154)
at com.persistit.DefaultValueCoder.render(DefaultValueCoder.java:1132)
at com.persistit.DefaultValueCoder.get(DefaultValueCoder.java:1065)
at com.persistit.Value.get(Value.java:2413)
at com.persistit.encoding.CollectionValueCoder.render(CollectionValueCoder.java:220)
at com.persistit.encoding.CollectionValueCoder.get(CollectionValueCoder.java:167)
at com.persistit.Value.get(Value.java:2413)
at com.persistit.DefaultValueCoder$ObjectFieldAccessor.fromValue(DefaultValueCoder.java:560)
at com.persistit.DefaultValueCoder.renderDefaultFields(DefaultValueCoder.java:1154)
at com.persistit.DefaultValueCoder.render(DefaultValueCoder.java:1132)
at com.persistit.DefaultValueCoder.get(DefaultValueCoder.java:1065)
at com.persistit.Value.get(Value.java:2413)
at com.persistit.encoding.CollectionValueCoder.render(CollectionValueCoder.java:232)
at com.persistit.encoding.CollectionValueCoder.get(CollectionValueCoder.java:167)
at com.persistit.Value.get(Value.java:2413)
at com.persistit.DefaultValueCoder$ObjectFieldAccessor.fromValue(DefaultValueCoder.java:560)
at com.persistit.DefaultValueCoder.renderDefaultFields(DefaultValueCoder.java:1154)
at com.persistit.DefaultValueCoder.render(DefaultValueCoder.java:1132)
at com.persistit.DefaultValueCoder.get(DefaultValueCoder.java:1065)
at com.persistit.Value.get(Value.java:2413)
at com.persistit.Value.get(Value.java:2015)
at org.sonar.batch.index.Cache$ValueIterator.next(Cache.java:400)
at org.sonar.batch.index.Cache$ValueIterator.next(Cache.java:373)
at org.sonar.core.issue.db.IssueStorage.batchInsert(IssueStorage.java:77)
at org.sonar.core.issue.db.IssueStorage.save(IssueStorage.java:66)
at org.sonar.batch.issue.IssuePersister.persist(IssuePersister.java:52)
at org.sonar.batch.phases.PhaseExecutor.executePersisters(PhaseExecutor.java:163)
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Can any one help me in finding out error,i am analysing project by setting java heap to 2048m in wrapper.conf i got out of memory heap size,so i tired to set java heap size to 5120 and sonar-runner-opts to 8192 but still its failing at same point,
These are the plugins which i have used abacus,checkstyles,pmd,java,useless code tracker
Database:mysql
Thanks in advance
Check the answer of this question .. it will help you wither to set the memory or fixing the issue of wrong selection with file extension
Sonar - OutOfMemoryError: Java heap space
If your code is to big then you have to break it into modules .. check this
http://docs.codehaus.org/display/ENUNCIATE/Multi-Module+Projects
I hope this could help!
Related
I'm pretty new to sonar but unfortunately I wasn't able to find any information in the net the last to days which could help me to solve my problem.
I'm running a SonarRunner on a Jenkins server and I'm trying to insert jUnit reports in order to see some content in the Coverage tab of the project on SonarQube.
The problem seems to be in loading the created jUnit report since the error message is pointing out to the junit framework:
INFO: SonarQube Server 5.3
13:39:28.405 INFO - Load global repositories
13:39:28.608 INFO - Load global repositories (done) | time=203ms
13:39:28.639 INFO - User cache: C:\Windows\system32\config\systemprofile\.sonar\cache
13:39:28.890 INFO - Load plugins index
13:39:28.890 INFO - Load plugins index (done) | time=0ms
13:39:29.202 INFO - Process project properties
13:39:29.249 INFO - Load project repositories
13:39:29.339 INFO - Load project repositories (done) | time=90ms
13:39:29.339 INFO - Apply project exclusions
13:39:29.444 INFO - Load quality profiles
13:39:29.516 INFO - Load quality profiles (done) | time=72ms
13:39:29.519 INFO - Load active rules
13:39:29.766 INFO - Load active rules (done) | time=247ms
13:39:29.771 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
13:39:29.771 INFO - Publish mode
13:39:29.771 INFO - ------------- Scan DatensatzManager
13:39:29.834 INFO - Load server rules
13:39:29.879 INFO - Load server rules (done) | time=45ms
13:39:29.911 INFO - Base dir: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src
13:39:29.911 INFO - Working dir: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\.sonar
13:39:29.911 INFO - Source paths: src
13:39:29.911 INFO - Test paths: test/com/carmeq/dia/dsm
13:39:29.911 INFO - Source encoding: windows-1252, default locale: de_DE
13:39:29.911 INFO - Index files
13:39:30.051 INFO - 162 files indexed
13:39:30.051 INFO - Quality profile for java: Sonar way
13:39:30.067 INFO - Sensor JavaSquidSensor
13:39:30.257 INFO - Configured Java source version: none
13:39:30.459 INFO - Java Main Files AST scan...
13:39:30.459 INFO - 144 source files to be analyzed
13:39:40.551 INFO - 99/144 files analyzed, current file: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\src\com\carmeq\dia\dsm\core\util\RawDatasetImportExport.java
13:39:50.558 INFO - 138/144 files analyzed, current file: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\src\com\carmeq\dia\dsm\template_editor\logic\GUIActions.java
13:39:51.303 INFO - Java Main Files AST scan done: 20844 ms
13:39:51.303 INFO - 144/144 source files have been analyzed
13:39:51.303 WARN - Java bytecode has not been made available to the analyzer. The org.sonar.java.bytecode.visitor.DependenciesVisitor#1f6e340, org.sonar.java.checks.UnusedPrivateMethodCheck#1f9344b are disabled.
13:39:51.303 INFO - Java Test Files AST scan...
13:39:51.303 INFO - 18 source files to be analyzed
13:39:51.702 INFO - Java Test Files AST scan done: 399 ms
13:39:51.702 INFO - 18/18 source files have been analyzed
13:39:51.702 INFO - Sensor JavaSquidSensor (done) | time=21635ms
13:39:51.702 INFO - Sensor Lines Sensor
13:39:51.718 INFO - Sensor Lines Sensor (done) | time=16ms
13:39:51.718 INFO - Sensor QProfileSensor
13:39:51.718 INFO - Sensor QProfileSensor (done) | time=0ms
13:39:51.718 INFO - Sensor SurefireSensor
13:39:51.718 INFO - parsing D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\report
13:39:51.792 WARN - Resource not found: junit.framework.TestSuite
13:39:51.795 INFO - Sensor SurefireSensor (done) | time=77ms
13:39:51.795 INFO - Sensor SCM Sensor
13:39:51.795 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
13:39:51.795 INFO - Sensor SCM Sensor (done) | time=0ms
13:39:51.795 INFO - Sensor Code Colorizer Sensor
13:39:51.798 INFO - Sensor Code Colorizer Sensor (done) | time=3ms
13:39:51.798 INFO - Sensor CPD Sensor
13:39:51.798 INFO - JavaCpdEngine is used for java
13:39:52.234 INFO - Sensor CPD Sensor (done) | time=436ms
13:39:52.602 INFO - Analysis report generated in 352ms, dir size=3 MB
13:39:52.986 INFO - Analysis reports compressed in 384ms, zip size=1 MB
13:39:53.102 INFO - Analysis report uploaded in 116ms
13:39:53.102 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/my:project
13:39:53.102 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
13:39:53.102 INFO - More about the report processing at http://localhost:9000/api/ce/task?id=AVLvPnH_lmKETL1ow_XQ
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 25.530s
Final Memory: 6M/134M
INFO: ------------------------------------------------------------------------
Finished: SUCCESS
I absolutely don't know why Sonar is searching for the junit.framework.TestSuite. Is there anyone who can help me to solve this?
Cheers!
Please note that surefire sensor is about execution of unit tests NOT coverage.
To get coverage displayed, you need to provide a coverage report that you can generate using JaCoCo (recommended way and included in sonar java plugin) or using cobertura (need to install the dedicated plugin for SonarQube).
The surefire sensor will only get you information about the execution of tests.
I have installed Hadoop 2.7.1 stable version. I followed Tom White's book for installation in Pseudodistributed mode. I did set all environment variables like JAVA_HOME, HADOOP_HOME, PATH etc.. I configured yarn-site.xml, hdfs-site.xml, core-site.xml, mapred-site.xml.
I copied the sample file file.txt using following command.
$hadoop fs -copyFromLocal textFiles/file.txt file.txt
which shows me
Found 2 items
-rw-r--r-- 1 RAMA supergroup 3737 2015-12-27 21:52 file.txt
drwxr-xr-x - RAMA supergroup 0 2015-12-27 22:17 input
When I am executing the wordcount program in hadoop-mapreduce-examples-2.7.1.jar using below command
RAMAs-MacBook-Pro:hadoop-2.7.1 RAMA$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.1.jar wordcount file.txt output
it is throwing me following exception, for which I am not able to find any feasible solution.
15/12/27 22:41:52 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
15/12/27 22:41:53 INFO client.RMProxy: Connecting to ResourceManager at localhost/127.0.0.1:8032
15/12/27 22:41:53 INFO input.FileInputFormat: Total input paths to process : 1
15/12/27 22:41:53 INFO mapreduce.JobSubmitter: number of splits:1
15/12/27 22:41:53 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1451216397139_0020
15/12/27 22:41:54 INFO impl.YarnClientImpl: Submitted application application_1451216397139_0020
15/12/27 22:41:54 INFO mapreduce.Job: The url to track the job: http://192.168.1.6:8088/proxy/application_1451216397139_0020/
15/12/27 22:41:54 INFO mapreduce.Job: Running job: job_1451216397139_0020
15/12/27 22:41:57 INFO mapreduce.Job: Job job_1451216397139_0020 running in uber mode : false
15/12/27 22:41:57 INFO mapreduce.Job: map 0% reduce 0%
15/12/27 22:41:57 INFO mapreduce.Job: Job job_1451216397139_0020 failed with state FAILED due to: Application application_1451216397139_0020 failed 2 times due to AM Container for appattempt_1451216397139_0020_000002 exited with exitCode: 127
For more detailed output, check application tracking page:http://192.168.1.6:8088/cluster/app/application_1451216397139_0020Then, click on links to logs of each attempt.
Diagnostics: Exception from container-launch.
Container id: container_1451216397139_0020_02_000001
Exit code: 127
Stack trace: ExitCodeException exitCode=127:
at org.apache.hadoop.util.Shell.runCommand(Shell.java:545)
at org.apache.hadoop.util.Shell.run(Shell.java:456)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:722)
at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:211)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:302)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Container exited with a non-zero exit code 127
Failing this attempt. Failing the application.
15/12/27 22:41:57 INFO mapreduce.Job: Counters: 0
Any suggestions/comments is of great help...
In hadoop-env.sh, explicitly add the java home path in JAVA_HOME variable.
I am trying to run wordcount example already provided in hadoop on the following env: (Pseudodistributed mode)
Windows 7
Hadoop 2.7.1
JDK 1.7.x
RAM 4 GB
The jps command returns
C:\deploy\hadoop-2.7.1>jps
2336 ResourceManager
7500 NameNode
4984 Jps
6900 NodeManager
4940 DataNode
The command I use for setting the hadoop heap size
set HADOOP_HEAPSIZE=512
The command I use from the hadoop home installation directory is
bin\yarn jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.1.jar wordcount /input /output
I see the following stack trace
C:\deploy\hadoop-2.7.1>bin\yarn jar share/hadoop/mapreduce/hadoop-mapreduce-exam
ples-2.7.1.jar wordcount /input /output
15/08/14 22:36:26 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0
:8032
15/08/14 22:36:27 INFO input.FileInputFormat: Total input paths to process : 1
15/08/14 22:36:28 INFO mapreduce.JobSubmitter: number of splits:1
15/08/14 22:36:28 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_14
39571873038_0001
15/08/14 22:36:28 INFO impl.YarnClientImpl: Submitted application application_14
39571873038_0001
15/08/14 22:36:28 INFO mapreduce.Job: The url to track the job: http://XXX-PC
:8088/proxy/application_1439571873038_0001/
15/08/14 22:36:28 INFO mapreduce.Job: Running job: job_1439571873038_0001
15/08/14 22:36:37 INFO mapreduce.Job: Job job_1439571873038_0001 running in uber
mode : false
15/08/14 22:36:37 INFO mapreduce.Job: map 0% reduce 0%
15/08/14 22:36:37 INFO mapreduce.Job: Job job_1439571873038_0001 failed with sta
te FAILED due to: Application application_1439571873038_0001 failed 2 times due
to AM Container for appattempt_1439571873038_0001_000002 exited with exitCode:
1
For more detailed output, check application tracking page:http://XXX-PC:8088/
cluster/app/application_1439571873038_0001Then, click on links to logs of each a
ttempt.
Diagnostics: Exception from container-launch.
Container id: container_1439571873038_0001_02_000001
Exit code: 1
Stack trace: ExitCodeException exitCode=1:
at org.apache.hadoop.util.Shell.runCommand(Shell.java:545)
at org.apache.hadoop.util.Shell.run(Shell.java:456)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:
722)
at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.la
unchContainer(DefaultContainerExecutor.java:211)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.C
ontainerLaunch.call(ContainerLaunch.java:302)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.C
ontainerLaunch.call(ContainerLaunch.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:744)
Shell output: 1 file(s) moved.
Container exited with a non-zero exit code 1
Failing this attempt. Failing the application.
15/08/14 22:36:37 INFO mapreduce.Job: Counters: 0
When I went to the Stderr logs as mentioned in the above stack trace, the actual error came out to be
Error: Could not create the Java Virtual Machine.
When I try to increase HADOOP_HEAPSIZE to 1024, the namenode, datanode and yarn daemons do not start at all and give me the same error of could not create java virtual machine
Has someone got the same problem ? How to solve this issue ?
You can solve this problem by editting the file /etc/hadoop/hadoop-env.sh like the one below:
export HADOOP_HEAPSIZE=3072
I am a newbie to SonarQube and I am working on creating a new Metrics for SOnarQube.
As a part of learning am trying the examples in the SonarQube site.
I was trying the example given here
I used maven clean and maven build in eclipse and created the jar file. I placed the jar file in the "extension/plugins" directory in the SonarQube server (I have locally installed the server in my Win 7 machine).
Then I used SonarQube Runner to link my project with SonarQube. How ever am getting this error:
C:\xxx\Desktop\Workspace\sonar-test>sonar-runner -e
C:\sonar-runner-2.4
SonarQube Runner 2.4
Java 1.6.0_21 Sun Microsystems Inc. (32-bit)
Windows 7 6.1 x86
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\sonar-runner-2.4\conf\sonar-runner.propertie
s
INFO: Project configuration file: C:\xxx\Desktop\Workspace\sona
r-test\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:\xxx\Desktop\Workspace\sonar-test\.\.so
nar
INFO: SonarQube Server 4.5.1
13:47:39.244 INFO - Load global referentials...
13:47:39.546 INFO - Load global referentials done: 308 ms
13:47:39.570 INFO - User cache: C:\xxx\.sonar\cache
13:47:39.597 INFO - Install plugins
13:47:39.994 INFO - Install JDBC driver
13:47:40.012 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
13:47:42.259 INFO - Initializing Hibernate
13:47:45.201 INFO - Load project referentials...
13:47:45.894 INFO - Load project referentials done: 693 ms
13:47:45.896 INFO - Load project settings
13:47:47.144 INFO - Loading technical debt model...
13:47:47.195 INFO - Loading technical debt model done: 51 ms
13:47:47.208 INFO - Apply project exclusions
13:47:47.920 INFO - ------------- Scan sonar-test
13:47:47.947 INFO - Load module settings
13:47:49.148 INFO - Loading rules...
13:47:50.030 INFO - Loading rules done: 882 ms
13:47:50.106 INFO - Configure Maven plugins
13:47:50.327 INFO - Compare to previous analysis (2014-11-06)
13:47:50.352 INFO - Compare over 30 days (2014-10-07, analysis of 2014-11-06 12
:28:06.816)
13:47:50.356 INFO - No quality gate is configured.
13:47:50.840 INFO - Base dir: C:\xxx\Desktop\Workspace\sonar-t
est\.
13:47:50.841 INFO - Working dir: C:\xxx\Desktop\Workspace\sona
r-test\.\.sonar
13:47:50.846 INFO - Source paths: src
13:47:50.847 INFO - Source encoding: UTF-8, default locale: en_US
13:47:50.849 INFO - Index files
13:47:51.001 INFO - 2 files indexed
13:47:51.146 INFO - Quality profile for java: Sonar way
13:47:51.171 INFO - Sensor JavaSquidSensor...
13:47:51.363 INFO - Java Main Files AST scan...
13:47:51.377 INFO - 2 source files to be analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 13.831s
Final Memory: 8M/99M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102
)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.tree.Tree.is(
[Lorg/sonar/plugins/java/api/tree/Tree$Kind;)Z
at org.sonar.samples.java.ExampleCheck.visitMethod(ExampleCheck.java:69)
at org.sonar.java.model.declaration.MethodTreeImpl.accept(MethodTreeImpl
.java:118)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:41)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:35)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitClass(BaseTreeVi
sitor.java:64)
at org.sonar.java.model.declaration.ClassTreeImpl.accept(ClassTreeImpl.j
ava:107)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:41)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:35)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitCompilationUnit(
BaseTreeVisitor.java:50)
at org.sonar.java.model.JavaTree$CompilationUnitTreeImpl.accept(JavaTree
.java:120)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:41)
at org.sonar.samples.java.ExampleCheck.scanFile(ExampleCheck.java:51)
at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:91)
at com.sonar.sslr.impl.ast.AstWalker.walkAndVisit(AstWalker.java:67)
at org.sonar.java.ast.AstScanner.simpleScan(AstScanner.java:118)
at org.sonar.java.ast.AstScanner.scan(AstScanner.java:83)
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:135)
at org.sonar.java.JavaSquid.scan(JavaSquid.java:128)
at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:8
6)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.
java:79)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:7
0)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanConta
iner.java:194)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.j
ava:233)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScan
Container.java:228)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanCon
tainer.java:221)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.ja
va:125)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapCon
tainer.java:173)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java
:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:87)
... 9 more
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
According to this example this must create a issue whenever it encounters a method and a annotation starting with a letter 'Z'.
I tried creating a class with such inputs:
sample.java
package test;
public class Sample {
public static void main(String[] args) {
System.out.println("Test");
}
#Ztest(val="hi")
public static void add()
{
System.out.println("Add Method");
}
}
I also created an annotation file:
Ztest.java
package test;
public #interface Ztest {
String val();
}
But when I execute with the SonarQube Runner am getting the above error.
Kindly help me with this.
NoSuchMethodError means that a class is found by the classloader, but the method is missing. This occurs when you are using an older or newer version of a library at runtime, than your rule was compiled with. If you have multiple versions of the same library on your classpath, this still can occur, since the classloader will only load the class once, and I'm not sure if one can tell which version it will use.
If you look at the dependencies of java-custom-rule, it depends on sonar-java-plugin version 2.5, please check if your sonarqube instance has the same version of this plugin.
EDIT tl;dr update your sonarqube java plugin
I have a java-project that I wish to do some analysis on using Sonar.
I have a build.xml file with a target called sonar that just points out where my sonar-ant-task.jar-file is located, and this is the rest:
<sonar:sonar workDir="${source.path}" key="${ant.project.name}" version="${version}" xmlns:sonar="antlib:org.sonar.ant">
When I run it I get this:
sonar:
[sonar:sonar] Apache Ant(TM) version 1.8.2 compiled on December 20 2010
[sonar:sonar] Sonar Ant Task version: 1.0
[sonar:sonar] Sonar work directory: PATH/src
[sonar:sonar] Sonar server: http://localhost:9000
[sonar:sonar] Sonar version: 3.0.1
[sonar:sonar] 09:16:47.958 INFO o.s.c.p.Database - Create JDBC datasource
[sonar:sonar] 09:16:48.672 INFO actDatabaseConnector - Initializing Hibernate
[sonar:sonar] 09:16:50.700 INFO .s.b.b.ProjectModule - ------------- Analyzing package
[sonar:sonar] 09:16:51.407 INFO .s.b.ProfileProvider - Selected quality profile : [name=Sonar way with Findbugs,language=java]
[sonar:sonar] 09:16:51.426 INFO nPluginsConfigurator - Configure maven plugins...
[sonar:sonar] 09:16:51.549 INFO org.sonar.INFO - Compare to previous analysis (2012-10-15)
[sonar:sonar] 09:16:51.588 INFO org.sonar.INFO - Compare over 5 days (2012-10-10, analysis of 2012-10-15 09:09:26.826)
[sonar:sonar] 09:16:51.621 INFO org.sonar.INFO - Compare over 30 days (2012-09-15, analysis of 2012-10-15 09:09:26.826)
[sonar:sonar] 09:16:51.664 INFO .b.p.SensorsExecutor - Initializer ProjectFileSystemLogger...
[sonar:sonar] 09:16:51.668 INFO .b.p.SensorsExecutor - Initializer ProjectFileSystemLogger done: 4 ms
[sonar:sonar] 09:16:51.679 INFO p.PhasesTimeProfiler - Sensor JavaSourceImporter...
[sonar:sonar] 09:16:51.713 INFO p.PhasesTimeProfiler - Sensor JavaSourceImporter done: 34 ms
[sonar:sonar] 09:16:51.713 INFO p.PhasesTimeProfiler - Sensor SquidSensor...
[sonar:sonar] 09:16:51.745 INFO .s.p.s.SquidExecutor - Java Squid scan...
[sonar:sonar] 09:16:51.749 INFO .s.p.s.SquidExecutor - Java Squid scan done: 4 ms
[sonar:sonar] 09:16:51.749 INFO p.PhasesTimeProfiler - Sensor SquidSensor done: 36 ms
[sonar:sonar] 09:16:51.750 INFO p.PhasesTimeProfiler - Sensor SurefireSensor...
[sonar:sonar] 09:16:51.751 INFO s.p.s.SurefireSensor - parsing PATH\src\target\surefire-reports
[sonar:sonar] 09:16:51.757 INFO p.PhasesTimeProfiler - Sensor SurefireSensor done: 7 ms
[sonar:sonar] 09:16:51.757 INFO p.PhasesTimeProfiler - Sensor CpdSensor...
[sonar:sonar] 09:16:51.757 INFO org.sonar.INFO - SonarEngine is used
[sonar:sonar] 09:16:51.758 INFO p.PhasesTimeProfiler - Sensor CpdSensor done: 0 ms
[sonar:sonar] 09:16:51.758 INFO p.PhasesTimeProfiler - Sensor ProfileSensor...
[sonar:sonar] 09:16:52.403 INFO p.PhasesTimeProfiler - Sensor ProfileSensor done: 645 ms
[sonar:sonar] 09:16:52.404 INFO p.PhasesTimeProfiler - Sensor ProfileEventsSensor...
[sonar:sonar] 09:16:52.435 INFO p.PhasesTimeProfiler - Sensor ProfileEventsSensor done: 31 ms
[sonar:sonar] 09:16:52.436 INFO p.PhasesTimeProfiler - Sensor VersionEventsSensor...
[sonar:sonar] 09:16:52.465 INFO p.PhasesTimeProfiler - Sensor VersionEventsSensor done: 29 ms
[sonar:sonar] 09:16:52.750 INFO p.PhasesTimeProfiler - Execute decorators...
[sonar:sonar] 09:16:52.910 INFO .b.p.UpdateStatusJob - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000
[sonar:sonar] 09:16:52.911 INFO b.p.PostJobsExecutor - Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
[sonar:sonar] 09:16:52.969 INFO b.p.PostJobsExecutor - Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
[sonar:sonar] 09:16:52.982 INFO .p.d.p.KeepOneFilter - -> Keep one snapshot per day between 2012-09-17 and 2012-10-15
[sonar:sonar] 09:16:52.984 INFO DefaultPeriodCleaner - <- Delete snapshot: 2012-10-15T09:11:13+0200 [463]
[sonar:sonar] 09:16:53.006 INFO .p.d.p.KeepOneFilter - -> Keep one snapshot per week between 2011-10-17 and 2012-09-17
[sonar:sonar] 09:16:53.006 INFO .p.d.p.KeepOneFilter - -> Keep one snapshot per month between 2007-10-22 and 2011-10-17
[sonar:sonar] 09:16:53.007 INFO .d.p.DeleteAllFilter - -> Delete data prior to: 2007-10-22
[sonar:sonar] 09:16:53.011 INFO o.s.c.purge.PurgeDao - -> Clean package [id=404]
BUILD SUCCESSFUL
Total time: 7 seconds
When I browse to http://localhost:9000 I can see the Sonar dashboard with my project but no lines analyzed, it's all empty and code coverage says '-'.
Any ideas?
Thanks!
Is there any configuration options in you build.xml under the sonar:sonar tag?
It seems that you use the Sonar Ant task v1.0. In this case you have to define where your source code is according to this wiki page.
If you are new to Sonar, maybe you should try the Sonar Ant task v2.0.