org.sonar.ce.task.projectanalysis.component.VisitException: Visit failed for Component {key=example,type=FILE} located example(type=PROJECT)


(Alain O'Dea) #1

I cannot scan Hello World level project with 7.6.

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)

SonarQube Enterprise 7.6.0.21501
SonarQube Scanner for Gradle 2.7

  • error observed (wrap logs/code around triple quote ``` for proper formatting)
org.sonar.ce.task.projectanalysis.component.VisitException: Visit failed for Component {key=HelloWorld-Lambda,type=FILE}  located HelloWorld-Lambda(type=PROJECT)
	at org.sonar.ce.task.projectanalysis.component.VisitException.rethrowOrWrap(VisitException.java:44)
	at org.sonar.ce.task.projectanalysis.component.PathAwareCrawler.visit(PathAwareCrawler.java:52)
	at org.sonar.ce.task.projectanalysis.component.PathAwareCrawler.visitChildren(PathAwareCrawler.java:87)
	at org.sonar.ce.task.projectanalysis.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:70)
	at org.sonar.ce.task.projectanalysis.component.PathAwareCrawler.visit(PathAwareCrawler.java:50)
	at org.sonar.ce.task.projectanalysis.step.PersistComponentsStep.execute(PersistComponentsStep.java:111)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:77)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:69)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:56)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.executeTask(CeWorkerImpl.java:137)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:100)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.withCustomizedThreadName(CeWorkerImpl.java:84)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:76)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:46)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Component name can't be empty
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
	at org.sonar.db.component.ComponentValidator.checkComponentName(ComponentValidator.java:40)
	at org.sonar.db.component.ComponentDto.setName(ComponentDto.java:333)
	at org.sonar.ce.task.projectanalysis.step.PersistComponentsStep$PersistComponentStepsVisitor.createForFile(PersistComponentsStep.java:332)
	at org.sonar.ce.task.projectanalysis.step.PersistComponentsStep$PersistComponentStepsVisitor.visitFile(PersistComponentsStep.java:221)
	at org.sonar.ce.task.projectanalysis.component.PathAwareCrawler.visitNode(PathAwareCrawler.java:105)
	at org.sonar.ce.task.projectanalysis.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:67)
	at org.sonar.ce.task.projectanalysis.component.PathAwareCrawler.visit(PathAwareCrawler.java:50)
	... 21 more
  • steps to reproduce
  1. Clone https://github.com/JenkinsSonarQubeTesting/HelloWorld-Lambda
  2. Add id "org.sonarqube" version "2.7" to the plugins block
  3. Run the following:
./gradlew sonarqube -Dsonar.projectKey=HelloWorld-Lambda \
                  -Dsonar.projectName=HelloWorld-Lambda \
                  -Dsonar.host.url=https://sonarqube.example.com \
                  -Dsonar.login=someRealSonarToken
  • potential workaround

None known.


(Simon Brandhof) #2

Hi Alain,

I can’t reproduce the issue on a fresh installation of SonarQube 7.6. Was this project already analyzed in a previous version?

++


(Alain O'Dea) #3

It was. Alexandre Frigout helped me find the cause. I was running a 7.4 server connected to the same database. It was taking some of the background tasks and conflicting with the 7.6 server.