How to upgrade database Sonarqube running on Windows

1k views Asked by At

I am trying to upgrade SonarQube from version 4.4 to version 5.1 and I keep running into problems on Windows 64-bit.

4.4 is currently running on 9000 and I'm pretty sure I've changed the wrapper and sonar conf files correctly.

Can someone tell me the correct steps to upgrade this correctly or point me in the right direction?

I am getting this error in the logs about upgrading the database:

Impossible to upgrade database

Migration failed: com/thoughtworks/xstream/XStream . Please check logs.

  Migration failed: com/thoughtworks/xstream/XStream .
2015.06.15 15:46:09 ERROR web[o.s.s.ui.JRubyFacade] Fail to upgrade database
com/thoughtworks/xstream/XStream
    org.sonar.plugins.findbugs.xml.FindBugsFilter.createXStream(FindBugsFilter.java:157)
    org.sonar.plugins.findbugs.FindbugsProfileImporter.importProfile(FindbugsProfileImporter.java:54)
    org.sonar.plugins.findbugs.SonarWayWithFindbugsProfile.createProfile(SonarWayWithFindbugsProfile.java:43)
    org.sonar.server.qualityprofile.RegisterQualityProfiles.profilesByLanguage(RegisterQualityProfiles.java:182)
    org.sonar.server.qualityprofile.RegisterQualityProfiles.start(RegisterQualityProfiles.java:91)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
    org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
    org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
    org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
    org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
    org.picocontainer.behaviors.Stored.start(Stored.java:110)
    org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015)
    org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008)
    org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766)
    org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91)
    org.sonar.server.platform.ServerComponents$1.doPrivileged(ServerComponents.java:851)
    org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:43)
    org.sonar.server.platform.ServerComponents.executeStartupTasks(ServerComponents.java:847)
    org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:126)
    org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:122)
    org.sonar.server.platform.Platform.doStart(Platform.java:81)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440)
    org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:304)
    org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:52)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
    org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
    org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
    org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
    org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:384)
    org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:336)
    org.jruby.runtime.BlockBody.call(BlockBody.java:73)
    org.jruby.runtime.Block.call(Block.java:101)
    org.jruby.RubyProc.call(RubyProc.java:290)
    org.jruby.RubyProc.call(RubyProc.java:228)
    org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:97)
    java.lang.Thread.run(Thread.java:745)

(I'm a coder, not an IT architect. Sorry for the naivety)

3

There are 3 answers

0
Morgan Kobeissi On

The problem is that the sonar-findbugs-plugin depends on the xstream jar which up until sonar version < 5.0 was provided transitively by the sonar-plugin-api. This dependency was removed from the sonar-plugin-api in version 5.0 as can be seen in SONAR-4118.

This however was only carried out after the sonar-findbugs-plugin ensured it had explicitly declared its dependency on the xstream module (so that it now packages it within its own jar). This was handled by SONARFBUGS-9 which is now available in the sonar-findbugs-plugin as of 2.4.

Given this, you will have to upgrade your sonar-findbugs-plugin to at least 2.4 and make sure you also upgrade the sonar-java-plugin to 2.4 as well since findbugs 2.4 seems to require that (else findbugs will throw an exception stating that it needs it).

This should solve the error thrown by the findbugs plugin when attempting to instantiate an XStream object

0
Abhijeet Kamble On

Please follow the below steps to upgrade SonarQube.

  1. Stop the SonarQube server
  2. Download and unzip the new SonarQube distribution in a fresh directory, let's say NEW_SONARQUBE_HOME.
  3. Update the content of the sonar.properties and wrapper.conf files located in the NEW_SONARQUBE_HOME/conf directory with the content of the related files in the OLD_SONARQUBE_HOME/conf directory (web server URL, database settings, etc.). Do not copy-paste the old files.
  4. Copy the OLD_SONARQUBE_HOME/extensions/plugins directory into NEW_SONARQUBE_HOME/extensions/plugins. (warning) Check the Compatibility Matrix for plugins compatibility and manually upgrade the plugins if necessary: . 5.If a custom JDBC driver is used, copy it into NEW_SONARQUBE_HOME/extensions/jdbc-driver/. (warning) Back up your database. (warning) If an es directory exists under data, remove the es directory (such a directory should not exist if step 3, above, was followed).
  5. Start the web server
  6. Browse to http://localhost:9000/setup (replace "localhost:9000" by your own URL) and follow the setup instructions.
  7. Analyze your projects to get fresh measures.
0
Tallandtree On

This doesn't work for us: I've upgraded SonarQube to 5.1.2. It works ok with FindBugs 3.2, but when I try to upgrade FindBugs to FindBugs 3.3 (sonar-findbugs-plugin-3.3.jar or sonar-findbugs-plugin-3.3.2.jar), it fails with the same error.

2015.09.21 10:40:14 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.NoClassDefFoundError: com/thoughtworks/xstream/XStream
    at org.sonar.plugins.findbugs.xml.FindBugsFilter.createXStream(FindBugsFilter.java:157) ~[na:na]
    at org.sonar.plugins.findbugs.FindbugsProfileImporter.importProfile(FindbugsProfileImporter.java:55) ~[na:na]
    at org.sonar.plugins.findbugs.SonarWayWithFindbugsProfile.createProfile(SonarWayWithFindbugsProfile.java:42) ~[na:na]