Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with Sonarqube version 8.7.0 #309

Closed
alekberovvusal opened this issue Feb 25, 2021 · 15 comments
Closed

Doesn't work with Sonarqube version 8.7.0 #309

alekberovvusal opened this issue Feb 25, 2021 · 15 comments

Comments

@alekberovvusal
Copy link

alekberovvusal commented Feb 25, 2021

Here is error message.
Plugin version: 1.6.0

2021.02.25 13:55:55 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.RuntimeException: Failed to load core extension Community Branch Plugin
	at org.sonar.core.extension.CoreExtensionsInstaller.install(CoreExtensionsInstaller.java:83)
	at org.sonar.core.extension.CoreExtensionsInstaller.lambda$install$2(CoreExtensionsInstaller.java:71)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	at org.sonar.core.extension.CoreExtensionsInstaller.install(CoreExtensionsInstaller.java:71)
	at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:572)
	at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:213)
	at org.sonar.server.platform.PlatformImpl.startLevel34Containers(PlatformImpl.java:187)
	at org.sonar.server.platform.PlatformImpl.access$500(PlatformImpl.java:46)
	at org.sonar.server.platform.PlatformImpl$1.lambda$doRun$0(PlatformImpl.java:120)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:370)
	at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:120)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:354)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: Unable to register extension com.github.mc1arke.sonarqube.plugin.server.CommunityBranchSupportDelegate
	at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:254)
	at org.sonar.core.extension.CoreExtensionsInstaller.addSupportedExtension(CoreExtensionsInstaller.java:118)
	at org.sonar.core.extension.CoreExtensionsInstaller.access$100(CoreExtensionsInstaller.java:40)
	at org.sonar.core.extension.CoreExtensionsInstaller$ContextImpl.addExtension(CoreExtensionsInstaller.java:161)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	at org.sonar.core.extension.CoreExtensionsInstaller$ContextImpl.addExtensions(CoreExtensionsInstaller.java:172)
	at com.github.mc1arke.sonarqube.plugin.CommunityBranchPlugin.load(CommunityBranchPlugin.java:75)
	at org.sonar.core.extension.CoreExtensionsInstaller.addDeclaredExtensions(CoreExtensionsInstaller.java:90)
	at org.sonar.core.extension.CoreExtensionsInstaller.install(CoreExtensionsInstaller.java:77)
	... 14 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/sonar/db/organization/OrganizationDto
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
	at org.picocontainer.injectors.AdaptingInjection$1.run(AdaptingInjection.java:203)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.picocontainer.injectors.AdaptingInjection.injectionMethodAnnotated(AdaptingInjection.java:200)
	at org.picocontainer.injectors.AdaptingInjection.methodAnnotatedInjectionAdapter(AdaptingInjection.java:171)
	at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(AdaptingInjection.java:70)
	at org.picocontainer.behaviors.AbstractBehaviorFactory.createComponentAdapter(AbstractBehaviorFactory.java:44)
	at org.picocontainer.behaviors.OptInCaching.createComponentAdapter(OptInCaching.java:45)
	at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:536)
	at org.picocontainer.DefaultPicoContainer.access$300(DefaultPicoContainer.java:84)
	at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addComponent(DefaultPicoContainer.java:1149)
	at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:252)
	... 23 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.sonar.db.organization.OrganizationDto
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 37 common frames omitted
2021.02.25 13:55:55 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
mc1arke added a commit that referenced this issue Mar 1, 2021
Sonarqube 8.7 removed the concept of the `OrganizationDto` and removed the reference to this class in the `BranchSupportDelegate` interface, so the `CommunityBranchSupportDelegate` implementation has had to update the relevant method signature, therefore making this version of the plugin binary incompatible with older versions of Sonarqube.

Alongside this, various webservice endpoints for configuring the global ALM definitions have been moved into the Community edition from the commercial Sonarqube editions, so have been removed from this plugin to prevent the bundled definitions conflicting with the plugin versions.

As Sonarqube Community Edition now has direct UI options for configuring Bitbucket Cloud, the relevant endpoints have been introduced for supporting this UI, and the Bitbucket Cloud client used for Pull Request decorating has been updated to use OAuth 2 credential negotiation for authenticating, rather than using the Basic authentication previously used on all requests.
mc1arke added a commit that referenced this issue Mar 1, 2021
Sonarqube 8.7 removed the concept of the `OrganizationDto` and removed the reference to this class in the `BranchSupportDelegate` interface, so the `CommunityBranchSupportDelegate` implementation has had to update the relevant method signature, therefore making this version of the plugin binary incompatible with older versions of Sonarqube.

Alongside this, various webservice endpoints for configuring the global ALM definitions have been moved into the Community edition from the commercial Sonarqube editions, so have been removed from this plugin to prevent the bundled definitions conflicting with the plugin versions.

As Sonarqube Community Edition now has direct UI options for configuring Bitbucket Cloud, the relevant endpoints have been introduced for supporting this UI, and the Bitbucket Cloud client used for Pull Request decorating has been updated to use OAuth 2 credential negotiation for authenticating, rather than using the Basic authentication previously used on all requests.
mc1arke added a commit that referenced this issue Mar 1, 2021
Sonarqube 8.7 removed the concept of the `OrganizationDto` and removed the reference to this class in the `BranchSupportDelegate` interface, so the `CommunityBranchSupportDelegate` implementation has had to update the relevant method signature, therefore making this version of the plugin binary incompatible with older versions of Sonarqube.

Alongside this, various webservice endpoints for configuring the global ALM definitions have been moved into the Community edition from the commercial Sonarqube editions, so have been removed from this plugin to prevent the bundled definitions conflicting with the plugin versions.

As Sonarqube Community Edition now has direct UI options for configuring Bitbucket Cloud, the relevant endpoints have been introduced for supporting this UI, and the Bitbucket Cloud client used for Pull Request decorating has been updated to use OAuth 2 credential negotiation for authenticating, rather than using the Basic authentication previously used on all requests.
mc1arke added a commit that referenced this issue Mar 6, 2021
Sonarqube 8.7 removed the concept of the `OrganizationDto` and removed the reference to this class in the `BranchSupportDelegate` interface, so the `CommunityBranchSupportDelegate` implementation has had to update the relevant method signature, therefore making this version of the plugin binary incompatible with older versions of Sonarqube.

Alongside this, various webservice endpoints for configuring the global ALM definitions have been moved into the Community edition from the commercial Sonarqube editions, so have been removed from this plugin to prevent the bundled definitions conflicting with the plugin versions.

As Sonarqube Community Edition now has direct UI options for configuring Bitbucket Cloud, the relevant endpoints have been introduced for supporting this UI, and the Bitbucket Cloud client used for Pull Request decorating has been updated to use OAuth 2 credential negotiation for authenticating, rather than using the Basic authentication previously used on all requests.
@bmaehr
Copy link

bmaehr commented Mar 8, 2021

Master did work for me with sonar 8.7 and gitlab after fixing the configuration. It is really annoying that SonarSource is doing so much refactoring.

I would suggest to change

to info to see the message in log file when searching for the problem.

@tcolgate
Copy link

Can confirm , sonarqube at least starts with the plugin from master 👍

@blueghost1983
Copy link

blueghost1983 commented Mar 11, 2021

It seems there're still some problem with pull request, got this error when handling pull request (merging to the main branch)
Error Details

java.lang.IllegalStateException: Could not find target branch 'null' in project
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.createPullRequest(CommunityBranchLoaderDelegate.java:98)
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:78)
	at com.github.mc1arke.sonarqube.plugin.ce.CommunityBranchLoaderDelegate.load(CommunityBranchLoaderDelegate.java:50)
	at org.sonar.ce.task.projectanalysis.component.BranchLoader.load(BranchLoader.java:44)
	at org.sonar.ce.task.projectanalysis.step.LoadReportAnalysisMetadataHolderStep.execute(LoadReportAnalysisMetadataHolderStep.java:74)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:81)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:72)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:59)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:235)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:217)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:162)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:137)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:89)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

@mc1arke
Copy link
Owner

mc1arke commented Mar 11, 2021

@blueghost1983 this doesn't contain enough information for this to be diagnosed. I suspect you've attempted to target a branch that Sonarqube doesn't actually know about, but without some information as to what parameters you're setting in the scanner, and what branches are currently visible in Sonarqube then I can't do any investigation.

@blueghost1983
Copy link

@mc1arke I finally found why I got the error. The default branch in azure devops repo is 'develop', but in sonarqube it is 'master', when pull request merges the branch to the 'develop' branch, the target branch can't be found in sonarqube. The solution is to change the 'master' branch name to same as default branch name in azure devops repo. anyway, thanks!

@bmaehr
Copy link

bmaehr commented Mar 11, 2021

I was able to add settings on the master branch, e.g.

`context.addExtensions(PropertyDefinition.builder(GitlabServerPullRequestDecorator.PULLREQUEST_CAN_FAIL_PIPELINE_ENABLED)`
                                          .category(CoreProperties.CATEGORY_GENERAL)
                                          .subCategory(CoreProperties.SUBCATEGORY_GENERAL)
                                          .onQualifiers(Qualifiers.PROJECT)
                                          .name("Fail pipeline if gate not reached")
                                          .description("Fail the pipeline if the Qualitiy Gate not passed succesfully.")
                                          .type(PropertyType.BOOLEAN)
                                          .defaultValue("true")
                                          .build());

it is displayed in the sonar UI, but when I do this analysis.getScannerProperty(PULLREQUEST_CAN_FAIL_PIPELINE_ENABLED) returns null.

@stevehipwell
Copy link

I'm having the same error on v8.7.0.

@Toilal
Copy link

Toilal commented Mar 17, 2021

It works when building from master branch.

@stevehipwell
Copy link

It does indeed work from master and I forked the repo to create a build for automation.

https://github.com/stevehipwell/sonarqube-community-branch-plugin/releases/tag/1.7.0-SNAPSHOT

@tcolgate
Copy link

I think the bug mentioned is a pre-existing bug, at least one reported for some non-github VCSs. I do get the error if a PR is targetting a branch other than master (current default branch), but PRs to master work fine.

@yfrindel
Copy link

yfrindel commented Mar 22, 2021

Hi,

Do you know if sonarqube-community-branch-plugin version 1.6.0 work at least with Sonarqube version 8.6.0 please?

Regards

@rastislav-panis
Copy link

it is working on 8.6.1-community, so should be still working on 8.6.0.

@chly1103
Copy link

chly1103 commented Mar 31, 2021

Version:Sonarqube 8.7.1+sonarqube-community-branch-plugin-1.7.0.jar

mvn sonar:sonar -Dsonar.projectKey=*** -Dsonar.projectName=*** -Dsonar.projectVersion=master -Dsonar.ws.timeout=30 -Dsonar.login=[MASKED] -Dsonar.sourceEncoding=UTF-8 -Dsonar.java.binaries=target/classes -Dsonar.java.test.binaries=target/test-classes -Dsonar.java.surefire.report=target/surefire-reports -Dsonar.test.inclusions=/test/ -Dsonar.exclusions=/test/ --settings=./settings.xml -Dsonar.branch.name=master

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar (default-cli) on project ils-parent: Failed to upload report - An error has occurred. Please contact your administrator -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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

Successful execution without parameter -Dsonar.branch.name=master

@mc1arke

image

image

@mc1arke
Copy link
Owner

mc1arke commented Apr 1, 2021

Fixed in 1.7.0 of the plugin

@mc1arke mc1arke closed this as completed Apr 1, 2021
@albertinisg
Copy link

I got crazy with this error due to the Azure DevOps new naming from master to main. This drove me crazy and comment from @blueghost1983 opened my eyes. Just changed the branch name in https://mysonarqube/project/branches?id=<projectName> and it worked straight away!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests