Error 404 on https://api.sonarcloud.io/analysis/analyses

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Scanner command used when applicable (private details masked): sonar-scanner -Dsonar.token=<redacted> -Dsonar.verbose=true
  • Languages of the repository: Java, Kotlin, Groovy, C++
  • Only if the SonarCloud project is public, the URL: Not a public project
  • Error observed:
09:31:51.534 DEBUG --> POST https://api.sonarcloud.io/analysis/analyses (189-byte body)
09:31:51.775 DEBUG <-- 404 https://api.sonarcloud.io/analysis/analyses (240ms, 0-byte body)
09:31:51.838 DEBUG Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda/0x00000151ce397410@459b6c53 during JVM shutdown
09:31:51.847 ERROR Error during SonarScanner Engine execution
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@58a9760d-org.sonar.scanner.report.ReportPublisher': Unsatisfied dependency expressed through constructor parameter 7: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@58a9760d-org.sonar.scanner.report.MetadataPublisher': Unsatisfied dependency expressed through constructor parameter 8: Error creating bean with name 'Analysis' defined in org.sonar.scanner.analysis.AnalysisProvider: Failed to instantiate [org.sonar.scanner.extension.api.Analysis]: Factory method 'provide' threw exception with message: Unable to create analysis
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:804)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:240)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1382)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1221)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:565)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:525)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:371)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:331)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.instantiateSingleton(DefaultListableBeanFactory.java:1218)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingleton(DefaultListableBeanFactory.java:1184)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1121)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:994)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:621)
        at org.sonar.scanner.spring.SpringComponentContainer.startComponents(SpringComponentContainer.java:207)
        at org.sonar.scanner.spring.SpringComponentContainer.execute(SpringComponentContainer.java:187)
        at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:150)
        at org.sonar.scanner.spring.SpringComponentContainer.startComponents(SpringComponentContainer.java:208)
        at org.sonar.scanner.spring.SpringComponentContainer.execute(SpringComponentContainer.java:187)
        at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:143)
        at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:58)
        at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:42)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@58a9760d-org.sonar.scanner.report.MetadataPublisher': Unsatisfied dependency expressed through constructor parameter 8: Error creating bean with name 'Analysis' defined in org.sonar.scanner.analysis.AnalysisProvider: Failed to instantiate [org.sonar.scanner.extension.api.Analysis]: Factory method 'provide' threw exception with message: Unable to create analysis
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:804)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:240)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1382)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1221)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:565)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:525)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:371)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:331)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:201)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:229)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:2008)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1971)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1814)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1711)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1651)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:912)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        ... 22 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Analysis' defined in org.sonar.scanner.analysis.AnalysisProvider: Failed to instantiate [org.sonar.scanner.extension.api.Analysis]: Factory method 'provide' threw exception with message: Unable to create analysis
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:645)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1362)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1194)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:565)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:525)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:371)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:331)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:201)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:229)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1762)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1651)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:912)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        ... 39 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.extension.api.Analysis]: Factory method 'provide' threw exception with message: Unable to create analysis
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.lambda$instantiate$0(SimpleInstantiationStrategy.java:183)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiateWithFactoryMethod(SimpleInstantiationStrategy.java:72)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:152)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 53 common frames omitted
Caused by: java.lang.IllegalStateException: Unable to create analysis
        at org.sonar.scanner.analysis.AnalysisCreator.handleAnalysisCreationException(AnalysisCreator.java:141)
        at org.sonar.scanner.analysis.AnalysisCreator.load(AnalysisCreator.java:129)
        at org.sonar.scanner.analysis.AnalysisCreator.createAnalysis(AnalysisCreator.java:100)
        at org.sonar.scanner.analysis.AnalysisCreator.create(AnalysisCreator.java:92)
        at java.base/java.util.Optional.orElseGet(Unknown Source)
        at org.sonar.scanner.analysis.AnalysisProvider.provide(AnalysisProvider.java:18)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.lambda$instantiate$0(SimpleInstantiationStrategy.java:155)
        ... 56 common frames omitted
Caused by: com.sonarsource.scanner.engine.webapi.client.HttpException: Error 404 on https://api.sonarcloud.io/analysis/analyses :
        at com.sonarsource.scanner.engine.webapi.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:22)
        at org.sonar.scanner.http.DefaultScannerWsClient.failIfUnauthorized(DefaultScannerWsClient.java:85)
        at org.sonar.scanner.http.DefaultScannerWsClient.call(DefaultScannerWsClient.java:58)
        at org.sonar.scanner.apiclient.DomainApiWsClientAdapter.call(DomainApiWsClientAdapter.java:46)
        at org.sonar.scanner.analysis.AnalysisCreator.load(AnalysisCreator.java:125)
        ... 63 common frames omitted
  • Steps to reproduce: It happens every time while running the above Sonar Scanner command. I have tried my best to copy the Sonar configuration from our Azure pipeline into a local sonar-project.properties. I have done this by (a) copying the “Additional properties” from the “Prepare Analysis Configuration” ADO task into the local file (including sonar.projectKey and sonar.projectName), (b) copying the organization name from the pipeline logs “Organization key” and setting sonar.organization to that, (c) setting sonar.host.url to https://sonarcloud.io, (d) I also tried it with and without sonar.pullrequest.key, sonar.pullrequest.branch and sonar.pullrequest.base, but got the same result whether I included them or not
  • Potential workaround: Our build is able to run past this point on CI. But we are having other issues with that, which is why I am trying to run the build locally, in order to troubleshoot said issues
1 Like

Hi,

This is a permissions error.

You’re copying over configuration. Did you copy over the sonar.token and/or create a new one?

 
Ann

I created a new token in my account->security settings, and then used that token both on the command-line (-Dsonar.token=xxx) and in the properties file (sonar.token=xxx). Are only certain types of users allowed to run analyses?

Hi,

Excellent question. The user the analysis token is from must have analysis permissions on the project. A project admin can check that for you.

 
HTH,
Ann

1 Like

I bet that’s what it was. The immediate need for this has now passed as we were able to resolve the other issue we were trying to troubleshoot but I will bear this in mind for next time!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.