[INFO] PicoLifecycleException: method 'public void org.sonar.jpa.session.AbstractDatabaseConnector.start()', instance 'org.sonar.jpa.session.DriverDatabaseConnector@3f26f816, java.lang.RuntimeException: wrapper
Database schema must be updated [version/required=152/170]. Please browse to your sonar homepage.
Then Stopped and started the Sonar..But this did not fix my issue.
Then I could not find anything on the google... Then it came to me that this message may be misleading.. and something else might be wrong.. so I checked my maven projects' POM file.
Then only it occurred to me that I did not specify the version for my sonar-maven-plugin in the POM file. SO, it must be always going for the latest version by default.. which is 2.5 and this 2.5 version of sonar-maven plugin was conflicting (i.e. not compatible) with my installed sonar server (which is at 2.4.1 version). Then, I specified the version number for the sonar-maven-plugin to be 2.4.1 and this fixed my issue.
Error Message that I was getting:
[INFO] ------------------------------------------------------------------------
[INFO] Building Suite Modules Build Project
[INFO] task-segment: [sonar:sonar] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [sonar:sonar {execution: default-cli}]
[INFO] Database dialect class org.sonar.jpa.dialect.MsSql
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] PicoLifecycleException: method 'public void org.sonar.jpa.session.AbstractDatabaseConnector.start()', instance 'org.sonar.jpa.session.DriverDatabaseConnector@3f26f816, java.lang.RuntimeException: wrapper
Database schema must be updated [version/required=152/170]. Please browse to your sonar homepage.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public void org.sonar.jpa.session.AbstractDatabaseConnector.start()', instance 'org.sonar.jpa.session.DriverDatabaseConnector@3f26f816, java.lang.RuntimeException: wrapper
at org.picocontainer.monitors.NullComponentMonitor.lifecycleInvocationFailed(NullComponentMonitor.java:77)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:132)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:115)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
at org.picocontainer.adapters.InstanceAdapter.start(InstanceAdapter.java:108)
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:996)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:989)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:746)
at org.sonar.batch.Batch.execute(Batch.java:65)
at org.sonar.maven.SonarMojo.executeBatch(SonarMojo.java:142)
at org.sonar.maven.SonarMojo.execute(SonarMojo.java:133)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.RuntimeException: wrapper
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:130)
... 31 more
Caused by: org.sonar.jpa.session.DatabaseException: Database schema must be updated [version/required=152/170]. Please browse to your sonar homepage.
at org.sonar.jpa.session.AbstractDatabaseConnector.start(AbstractDatabaseConnector.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
... 30 more
Solution to fix this issue
1) Check the version of your installed sonar server. e.g mine is 2.4.1
2) specify this same version number for your sonar-maven-plugin in your projects POM file as shown below:
<build>
....................
<plugins>
......................
<plugins>
......................
.......................
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.4.1</version> <!-- please do not remove this version.. we need this one only.. -->
</plugin>
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.4.1</version> <!-- please do not remove this version.. we need this one only.. -->
</plugin>
.............
</plugins>
</plugins>
....................
</build>It is a standard behavior of Maven POMs that if we do not specify the version number for the given artifact then maven will try to find the latest version for this artifact. So, in our case, the latest version of sonar-maven-plugin was not compatible with installed version of sonar server. So, I had to specify the version number for the sonar-maven-plugin explicitly.
I hope this helps you. If something is wrong here... and you think of a better solution then please let me know on this blog. Cheers!
man, this helped me a lot.
ReplyDeleteGlad to know it helped you.. :)
ReplyDeleteThanks Pushkar...i could fix my prob reading thru ur solution
ReplyDeleteI am glad it helped you! you could click on some ads displayed while you are here.. to appreciate this post :p
ReplyDeleteThanks this problem freak me out.
ReplyDeleteglad it help you :)
ReplyDelete