We receive a NoClassDefFoundError during our startup the SonarQuebe server 7.0

compatibility

(asish) #1

We have our own sonar custom java rules.
But we receive a NoClassDefFoundError during our startup the SonarQuebe server 7.0.
We use the Sonar Java plugin 5.1
Could you please help me how to resolve the problem

2018.08.10 14:58:37 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
	at com.nrift.sonar.rules.utils.ResourceUtils.getResources(ResourceUtils.java:52)
	at com.nrift.sonar.rules.base.SonarJavaFileScannersFactory.checkClasses(SonarJavaFileScannersFactory.java:67)
	at com.nrift.sonar.rules.base.JavaRulesDefinition.define(JavaRulesDefinition.java:37)
	at org.sonar.server.rule.RuleDefinitionsLoader.load(RuleDefinitionsLoader.java:56)
	at org.sonar.server.rule.RegisterRules.start(RegisterRules.java:103)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
	at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
	at org.picocontainer.behaviors.Stored.start(Stored.java:110)
	at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:134)
	at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
	at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:44)
	at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:81)
	at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:45)
	at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:78)
	at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:196)
	at org.sonar.server.platform.Platform.access$400(Platform.java:46)
	at org.sonar.server.platform.Platform$1.lambda$doRun$1(Platform.java:121)
	at org.sonar.server.platform.Platform$1$$Lambda$911/1819256280.run(Unknown Source)
	at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
	at org.sonar.server.platform.Platform$1.doRun(Platform.java:121)
	at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
	at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
	at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
	... 32 common frames omitted
2018.08.10 14:58:37 INFO  web[][o.s.p.StopWatcher] Stopping process

(Nicolas Bontoux) #2

Hi,

NoClassDefFoundError is often a symptom of compatibility problem. The stacktrace actually tells you which on which component it’s choking :

	at com.nrift.sonar.rules.utils.ResourceUtils.getResources(ResourceUtils.java:52)
	at com.nrift.sonar.rules.base.SonarJavaFileScannersFactory.checkClasses(SonarJavaFileScannersFactory.java:67)
	at com.nrift.sonar.rules.base.JavaRulesDefinition.define(JavaRulesDefinition.java:37)

You need to find out what that nrift is and where it comes from. Likely a custom plugin you’re using and which would not be compatible with your SonarQube version.