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

SonarQube 7.9.3 LTS Exception #190

Closed
jolt23 opened this issue May 5, 2020 · 8 comments
Closed

SonarQube 7.9.3 LTS Exception #190

jolt23 opened this issue May 5, 2020 · 8 comments

Comments

@jolt23
Copy link

jolt23 commented May 5, 2020

We are currently upgrading to 7.9.3 Developer Edition LTS and have stumbled on the following exeption being drown during start up when aem-rules 1.1 plugin is installed.

sonarqube_1  | 2020.05.05 18:06:05 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
sonarqube_1  | java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, java.lang.Object, java.lang.Object)'
sonarqube_1  |  at com.google.common.io.Resources.getResource(Resources.java:207)
sonarqube_1  |  at com.cognifide.aemrules.extensions.RulesLoader.loadResource(RulesLoader.java:126)
sonarqube_1  |  at com.cognifide.aemrules.extensions.RulesLoader.loadDescription(RulesLoader.java:119)
sonarqube_1  |  at com.cognifide.aemrules.extensions.RulesLoader.createRule(RulesLoader.java:87)
sonarqube_1  |  at com.cognifide.aemrules.extensions.RulesLoader.lambda$loadRule$0(RulesLoader.java:80)
sonarqube_1  |  at java.base/java.util.Optional.map(Unknown Source)
sonarqube_1  |  at com.cognifide.aemrules.extensions.RulesLoader.loadRule(RulesLoader.java:80)
sonarqube_1  |  at com.cognifide.aemrules.extensions.RulesLoader.load(RulesLoader.java:73)
sonarqube_1  |  at com.cognifide.aemrules.extensions.AemRulesRulesDefinition.defineJavaRepository(AemRulesRulesDefinition.java:49)
sonarqube_1  |  at com.cognifide.aemrules.extensions.AemRulesRulesDefinition.define(AemRulesRulesDefinition.java:33)
sonarqube_1  |  at org.sonar.server.rule.RuleDefinitionsLoader.load(RuleDefinitionsLoader.java:56)
sonarqube_1  |  at org.sonar.server.rule.RegisterRules.start(RegisterRules.java:118)
sonarqube_1  |  at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
sonarqube_1  |  at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
sonarqube_1  |  at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
sonarqube_1  |  at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
sonarqube_1  |  at org.picocontainer.behaviors.Stored.start(Stored.java:110)
sonarqube_1  |  at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
sonarqube_1  |  at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
sonarqube_1  |  at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
sonarqube_1  |  at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
sonarqube_1  |  at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
sonarqube_1  |  at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:47)
sonarqube_1  |  at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:83)
sonarqube_1  |  at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:46)
sonarqube_1  |  at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:80)
sonarqube_1  |  at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:196)
sonarqube_1  |  at org.sonar.server.platform.Platform.access$400(Platform.java:46)
sonarqube_1  |  at org.sonar.server.platform.Platform$1.lambda$doRun$1(Platform.java:121)
sonarqube_1  |  at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
sonarqube_1  |  at org.sonar.server.platform.Platform$1.doRun(Platform.java:121)
sonarqube_1  |  at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
sonarqube_1  |  at java.base/java.lang.Thread.run(Unknown Source)

We can reproduce this on our locals, running docker containers as well. Switching back to version 1.0 of the plugin has worked however we have yet run analysis to test the results.

I have attached a sample of what our configuration / plugin installation looks like.

sonarqube-support-info-46AF5D23-AXHLLS0UyRA2i4P9ZRxN-2020-5-5-14-13.json.zip

@jplucinski jplucinski assigned jplucinski and unassigned jplucinski May 6, 2020
@toniedzwiedz
Copy link
Collaborator

Hi @jolt23, thanks for reporting this.

It seems there is a conflicting version of Guava on the classpath. At a glance, the way Guava is managed as a dependency seems in line with the recommendations so we're not sure where the root cause is yet. In theory, every plugin should use its own classloader and I can see that Guava 28 gets included in the Jar file. This could have to do with the dependencies on the Java plugin and the HTML plugin, although I'd expect this bug to crop up immediately after installing the plugin anywhere if that were the only cause. It may have to do with one of the other plugins you have installed. The configuration attached is very helpful. We'll reproduce this and try to find it.

Quick dependency check via IntelliJ
sonar-aemrules-plugin-dependencies

@toniedzwiedz
Copy link
Collaborator

Quick note, other than solving the dependency conflict, we could consider a quick fix and rewrite those lines to use a more widely available API. That way this conflict may be rendered harmless. Worth a try before jumping down the rabbit hole.

Interestingly, the top two lines of the stack trace belong to Guava.

sonarqube_1  | 2020.05.05 18:06:05 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
sonarqube_1  | java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, java.lang.Object, java.lang.Object)'
sonarqube_1  |  at com.google.common.io.Resources.getResource(Resources.java:207)
sonarqube_1  |  at com.cognifide.aemrules.extensions.RulesLoader.loadResource(RulesLoader.java:126)

In other words, a version of com.google.common.io.Resources#getResource was loaded that calls the com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, java.lang.Object, java.lang.Object). At the same time, the latter (available since Guava 20) isn't found (at least not with that signature). Worth looking at a heap dump.

@jplucinski
Copy link
Collaborator

Hi @jolt23,
AEM Rules 1.1 requires Java Plugin 6.1. I' sure that SQ 7.9.3 uses Java Plugin in version 5 initially. You should update it before starting server.

@jolt23
Copy link
Author

jolt23 commented May 6, 2020

@jplucinski we tried changing sonar-java-plugin back to 6.1 from 6.3 but still having the same issue with the dependency clash.

For now we will keep version aem-rules 1.0 as it works. I will try to do more testing today and will let you know if I find anything else.

@djsnoopy
Copy link

djsnoopy commented May 20, 2020

Fresh installation of SonarQube 8.3.1 in docker (official image) -> Developer Edition
All default plugins updated to latest version.
Same problem while installing the AEM Rules plugin directly from market-place.

@toniedzwiedz
Copy link
Collaborator

Hi @jolt23, we're releasing v1.2, which should fix this. Sorry it took so long.
It should be posted in the Marketplace soon. In the meantime, you could have a try with the Jar file.
https://github.com/Cognifide/AEM-Rules-for-SonarQube/releases/tag/v1.2

@jolt23
Copy link
Author

jolt23 commented Aug 19, 2020

@toniedzwiedz no worries, I will add this on our next sprint to upgrade the plugin and validate.

@jolt23
Copy link
Author

jolt23 commented Sep 2, 2020

@toniedzwiedz this issue can be closed we validated in several environments no issues during startup with v1.2.

@jolt23 jolt23 closed this as completed Feb 11, 2021
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

4 participants