Quantcast

NonUniqueResultException

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

NonUniqueResultException

Reinhard Nägele
Hello,

We have a fresh Sonar 3.0 installation. I just recently noticed that one
of our projects is listed twice. Yesterday, the projects version was
changed among other things which caused Sonar to be executed on the
project on our Hudson server. The result was the stacktrace below. The
project is still listed twice in Sonar, now once with the old version
and once with the new version.

Thanks for any assistance,
Reinhard


[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project
foo: Can not execute Sonar: Expected single result, but got :
[Snapshot[resourceId=1631,buildDate=2012-05-15
16:13:21.299,createdAt=2012-05-15
16:13:18.44,version=3.0.0-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-30,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-30
05:03:16.273,period2Date=2012-05-10 16:13:18.44,period3Date=2012-04-15
16:13:18.44,period4Date=<null>,period5Date=<null>,id=26977],
Snapshot[resourceId=1631,buildDate=2012-04-30
05:03:17.111,createdAt=2012-04-30
05:03:16.273,version=2.13-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-19,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-19
14:28:20.047,period2Date=2012-04-25 05:03:16.273,period3Date=2012-03-31
05:03:16.273,period4Date=<null>,period5Date=<null>,id=16066]] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar
(default-cli) on project foo: Can not execute Sonar
     at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
     at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
     at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
     at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
     at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
     at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
     at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
     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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
     at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
     at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
     at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not
execute Sonar
     at
org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
     at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
     at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
     at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
     at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
     ... 19 more
Caused by: javax.persistence.NonUniqueResultException: Expected single
result, but got : [Snapshot[resourceId=1631,buildDate=2012-05-15
16:13:21.299,createdAt=2012-05-15
16:13:18.44,version=3.0.0-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-30,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-30
05:03:16.273,period2Date=2012-05-10 16:13:18.44,period3Date=2012-04-15
16:13:18.44,period4Date=<null>,period5Date=<null>,id=26977],
Snapshot[resourceId=1631,buildDate=2012-04-30
05:03:17.111,createdAt=2012-04-30
05:03:16.273,version=2.13-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-19,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-19
14:28:20.047,period2Date=2012-04-25 05:03:16.273,period3Date=2012-03-31
05:03:16.273,period4Date=<null>,period5Date=<null>,id=16066]]
     at
org.sonar.jpa.session.JpaDatabaseSession.getSingleResult(JpaDatabaseSession.java:195)
     at
org.sonar.jpa.session.JpaDatabaseSession.getSingleResult(JpaDatabaseSession.java:213)
     at
org.sonar.batch.ProjectConfigurator.isLatestAnalysis(ProjectConfigurator.java:84)
     at
org.sonar.batch.ProjectConfigurator.configure(ProjectConfigurator.java:71)
     at org.sonar.batch.ProjectTree.doStart(ProjectTree.java:89)
     at org.sonar.batch.ProjectTree.start(ProjectTree.java:66)
     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)
     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:1009)
     at
org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1002)
     at
org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:760)
     at
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:70)
     at org.sonar.batch.bootstrap.Module.start(Module.java:82)
     at
org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:109)
     at org.sonar.batch.bootstrap.Module.start(Module.java:83)
     at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:72)
     at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:59)
     at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:143)
     at
org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
     ... 23 more


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NonUniqueResultException

Freddy Mallet
Hi Reinhard,

In fact you're facing two different issues :
  1. You've changed the key (groupId:artifactId) of your project and so this project is duplicated in the Sonar UI. To fix this issue you just have to log into Sonar with an administrator account and to go to the "Project Deletion" page of the old project. This is plan to support the update of project key in Sonar 3.2 : http://jira.codehaus.org/browse/SONAR-1608
  2. You've launched at least two Sonar analysis at the same and on the same project and now you get a NonUniqueResultException : http://jira.codehaus.org/browse/SONAR-2761. Remove your project by using the same "Project Deletion" page and prevent launching two Sonar analysis at the same time and on the same project.
Kind regards,
Freddy

-----
Sonar for Continuous Inspection



On Wed, May 16, 2012 at 8:00 AM, Reinhard Nägele <[hidden email]> wrote:
Hello,

We have a fresh Sonar 3.0 installation. I just recently noticed that one of our projects is listed twice. Yesterday, the projects version was changed among other things which caused Sonar to be executed on the project on our Hudson server. The result was the stacktrace below. The project is still listed twice in Sonar, now once with the old version and once with the new version.

Thanks for any assistance,
Reinhard


[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project foo: Can not execute Sonar: Expected single result, but got : [Snapshot[resourceId=1631,buildDate=2012-05-15 16:13:21.299,createdAt=2012-05-15 16:13:18.44,version=3.0.0-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-30,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-30 05:03:16.273,period2Date=2012-05-10 16:13:18.44,period3Date=2012-04-15 16:13:18.44,period4Date=<null>,period5Date=<null>,id=26977], Snapshot[resourceId=1631,buildDate=2012-04-30 05:03:17.111,createdAt=2012-04-30 05:03:16.273,version=2.13-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-19,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-19 14:28:20.047,period2Date=2012-04-25 05:03:16.273,period3Date=2012-03-31 05:03:16.273,period4Date=<null>,period5Date=<null>,id=16066]] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project foo: Can not execute Sonar
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
   at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
   at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
   at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
   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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
   at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
   at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
   at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
   ... 19 more
Caused by: javax.persistence.NonUniqueResultException: Expected single result, but got : [Snapshot[resourceId=1631,buildDate=2012-05-15 16:13:21.299,createdAt=2012-05-15 16:13:18.44,version=3.0.0-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-30,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-30 05:03:16.273,period2Date=2012-05-10 16:13:18.44,period3Date=2012-04-15 16:13:18.44,period4Date=<null>,period5Date=<null>,id=26977], Snapshot[resourceId=1631,buildDate=2012-04-30 05:03:17.111,createdAt=2012-04-30 05:03:16.273,version=2.13-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-19,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-19 14:28:20.047,period2Date=2012-04-25 05:03:16.273,period3Date=2012-03-31 05:03:16.273,period4Date=<null>,period5Date=<null>,id=16066]]
   at org.sonar.jpa.session.JpaDatabaseSession.getSingleResult(JpaDatabaseSession.java:195)
   at org.sonar.jpa.session.JpaDatabaseSession.getSingleResult(JpaDatabaseSession.java:213)
   at org.sonar.batch.ProjectConfigurator.isLatestAnalysis(ProjectConfigurator.java:84)
   at org.sonar.batch.ProjectConfigurator.configure(ProjectConfigurator.java:71)
   at org.sonar.batch.ProjectTree.doStart(ProjectTree.java:89)
   at org.sonar.batch.ProjectTree.start(ProjectTree.java:66)
   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)
   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:1009)
   at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1002)
   at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:760)
   at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:70)
   at org.sonar.batch.bootstrap.Module.start(Module.java:82)
   at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:109)
   at org.sonar.batch.bootstrap.Module.start(Module.java:83)
   at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:72)
   at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:59)
   at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:143)
   at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
   ... 23 more


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NonUniqueResultException

Reinhard Nägele
Freddy,

Neither of the two is the case. Sonar is executed exclusively with a dedicated Hudson job, which cannot be run multiple times simultaneously. Keys have not changed either. Both projects listed on the overview page link to the project with the same id (same project url).

Reinhard


Am 16.05.2012 22:14, schrieb Freddy Mallet:
Hi Reinhard,

In fact you're facing two different issues :
  1. You've changed the key (groupId:artifactId) of your project and so this project is duplicated in the Sonar UI. To fix this issue you just have to log into Sonar with an administrator account and to go to the "Project Deletion" page of the old project. This is plan to support the update of project key in Sonar 3.2 : http://jira.codehaus.org/browse/SONAR-1608
  2. You've launched at least two Sonar analysis at the same and on the same project and now you get a NonUniqueResultException : http://jira.codehaus.org/browse/SONAR-2761. Remove your project by using the same "Project Deletion" page and prevent launching two Sonar analysis at the same time and on the same project.
Kind regards,
Freddy

-----
Sonar for Continuous Inspection



On Wed, May 16, 2012 at 8:00 AM, Reinhard Nägele <[hidden email]> wrote:
Hello,

We have a fresh Sonar 3.0 installation. I just recently noticed that one of our projects is listed twice. Yesterday, the projects version was changed among other things which caused Sonar to be executed on the project on our Hudson server. The result was the stacktrace below. The project is still listed twice in Sonar, now once with the old version and once with the new version.

Thanks for any assistance,
Reinhard


[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project foo: Can not execute Sonar: Expected single result, but got : [Snapshot[resourceId=1631,buildDate=2012-05-15 16:13:21.299,createdAt=2012-05-15 16:13:18.44,version=3.0.0-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-30,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-30 05:03:16.273,period2Date=2012-05-10 16:13:18.44,period3Date=2012-04-15 16:13:18.44,period4Date=<null>,period5Date=<null>,id=26977], Snapshot[resourceId=1631,buildDate=2012-04-30 05:03:17.111,createdAt=2012-04-30 05:03:16.273,version=2.13-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-19,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-19 14:28:20.047,period2Date=2012-04-25 05:03:16.273,period3Date=2012-03-31 05:03:16.273,period4Date=<null>,period5Date=<null>,id=16066]] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project foo: Can not execute Sonar
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
   at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
   at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
   at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
   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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
   at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
   at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
   at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
   ... 19 more
Caused by: javax.persistence.NonUniqueResultException: Expected single result, but got : [Snapshot[resourceId=1631,buildDate=2012-05-15 16:13:21.299,createdAt=2012-05-15 16:13:18.44,version=3.0.0-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-30,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-30 05:03:16.273,period2Date=2012-05-10 16:13:18.44,period3Date=2012-04-15 16:13:18.44,period4Date=<null>,period5Date=<null>,id=26977], Snapshot[resourceId=1631,buildDate=2012-04-30 05:03:17.111,createdAt=2012-04-30 05:03:16.273,version=2.13-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-19,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-19 14:28:20.047,period2Date=2012-04-25 05:03:16.273,period3Date=2012-03-31 05:03:16.273,period4Date=<null>,period5Date=<null>,id=16066]]
   at org.sonar.jpa.session.JpaDatabaseSession.getSingleResult(JpaDatabaseSession.java:195)
   at org.sonar.jpa.session.JpaDatabaseSession.getSingleResult(JpaDatabaseSession.java:213)
   at org.sonar.batch.ProjectConfigurator.isLatestAnalysis(ProjectConfigurator.java:84)
   at org.sonar.batch.ProjectConfigurator.configure(ProjectConfigurator.java:71)
   at org.sonar.batch.ProjectTree.doStart(ProjectTree.java:89)
   at org.sonar.batch.ProjectTree.start(ProjectTree.java:66)
   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)
   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:1009)
   at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1002)
   at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:760)
   at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:70)
   at org.sonar.batch.bootstrap.Module.start(Module.java:82)
   at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:109)
   at org.sonar.batch.bootstrap.Module.start(Module.java:83)
   at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:72)
   at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:59)
   at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:143)
   at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
   ... 23 more


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NonUniqueResultException

Freddy Mallet
Hi Reinhard,

To temporary fix this issue you must execute one of the following SQL requests :
  • MySQL
    • update snapshots old_snap, snapshots new_snap set old_snap.islast=0 where old_snap.islast=1 and new_snap.created_at > old_snap.created_at and new_snap.project_id = old_snap.project_id and new_snap.islast=1
  • Oracle 
    • update sonar.snapshots old_snap set old_snap.islast=0 where islast=1 and exists(select * from sonar.snapshots new_snap where new_snap.created_at > old_snap.created_at and new_snap.project_id = old_snap.project_id and new_snap.islast=1)
  • PostgreSQL
    • update snapshots old_snap set islast=false where islast=true and exists(select * from snapshots new_snap where new_snap.created_at > old_snap.created_at and new_snap.project_id = old_snap.project_id and new_snap.islast=true)
Could you retrieve the first Sonar analysis which failed ? Indeed, this error stack trace could help me better understand what happened.

Thanks
Freddy

-----
Sonar for Continuous Inspection



On Mon, May 21, 2012 at 3:18 PM, Reinhard Nägele <[hidden email]> wrote:
Freddy,

Neither of the two is the case. Sonar is executed exclusively with a dedicated Hudson job, which cannot be run multiple times simultaneously. Keys have not changed either. Both projects listed on the overview page link to the project with the same id (same project url).

Reinhard


Am 16.05.2012 22:14, schrieb Freddy Mallet:
Hi Reinhard,

In fact you're facing two different issues :
  1. You've changed the key (groupId:artifactId) of your project and so this project is duplicated in the Sonar UI. To fix this issue you just have to log into Sonar with an administrator account and to go to the "Project Deletion" page of the old project. This is plan to support the update of project key in Sonar 3.2 : http://jira.codehaus.org/browse/SONAR-1608
  2. You've launched at least two Sonar analysis at the same and on the same project and now you get a NonUniqueResultException : http://jira.codehaus.org/browse/SONAR-2761. Remove your project by using the same "Project Deletion" page and prevent launching two Sonar analysis at the same time and on the same project.
Kind regards,
Freddy

-----
Sonar for Continuous Inspection



On Wed, May 16, 2012 at 8:00 AM, Reinhard Nägele <[hidden email]> wrote:
Hello,

We have a fresh Sonar 3.0 installation. I just recently noticed that one of our projects is listed twice. Yesterday, the projects version was changed among other things which caused Sonar to be executed on the project on our Hudson server. The result was the stacktrace below. The project is still listed twice in Sonar, now once with the old version and once with the new version.

Thanks for any assistance,
Reinhard


[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project foo: Can not execute Sonar: Expected single result, but got : [Snapshot[resourceId=1631,buildDate=2012-05-15 16:13:21.299,createdAt=2012-05-15 16:13:18.44,version=3.0.0-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-30,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-30 05:03:16.273,period2Date=2012-05-10 16:13:18.44,period3Date=2012-04-15 16:13:18.44,period4Date=<null>,period5Date=<null>,id=26977], Snapshot[resourceId=1631,buildDate=2012-04-30 05:03:17.111,createdAt=2012-04-30 05:03:16.273,version=2.13-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-19,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-19 14:28:20.047,period2Date=2012-04-25 05:03:16.273,period3Date=2012-03-31 05:03:16.273,period4Date=<null>,period5Date=<null>,id=16066]] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project foo: Can not execute Sonar
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
   at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
   at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
   at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
   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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
   at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
   at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
   at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
   ... 19 more
Caused by: javax.persistence.NonUniqueResultException: Expected single result, but got : [Snapshot[resourceId=1631,buildDate=2012-05-15 16:13:21.299,createdAt=2012-05-15 16:13:18.44,version=3.0.0-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-30,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-30 05:03:16.273,period2Date=2012-05-10 16:13:18.44,period3Date=2012-04-15 16:13:18.44,period4Date=<null>,period5Date=<null>,id=26977], Snapshot[resourceId=1631,buildDate=2012-04-30 05:03:17.111,createdAt=2012-04-30 05:03:16.273,version=2.13-SNAPSHOT,last=true,status=P,purgeStatus=<null>,scope=PRJ,path=,depth=0,qualifier=TRK,rootId=<null>,parentId=<null>,rootProjectId=1631,period1Mode=previous_analysis,period2Mode=days,period3Mode=days,period4Mode=<null>,period5Mode=<null>,period1Param=2012-04-19,period2Param=5,period3Param=30,period4Param=<null>,period5Param=<null>,period1Date=2012-04-19 14:28:20.047,period2Date=2012-04-25 05:03:16.273,period3Date=2012-03-31 05:03:16.273,period4Date=<null>,period5Date=<null>,id=16066]]
   at org.sonar.jpa.session.JpaDatabaseSession.getSingleResult(JpaDatabaseSession.java:195)
   at org.sonar.jpa.session.JpaDatabaseSession.getSingleResult(JpaDatabaseSession.java:213)
   at org.sonar.batch.ProjectConfigurator.isLatestAnalysis(ProjectConfigurator.java:84)
   at org.sonar.batch.ProjectConfigurator.configure(ProjectConfigurator.java:71)
   at org.sonar.batch.ProjectTree.doStart(ProjectTree.java:89)
   at org.sonar.batch.ProjectTree.start(ProjectTree.java:66)
   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)
   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:1009)
   at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1002)
   at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:760)
   at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:70)
   at org.sonar.batch.bootstrap.Module.start(Module.java:82)
   at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:109)
   at org.sonar.batch.bootstrap.Module.start(Module.java:83)
   at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:72)
   at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:59)
   at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:143)
   at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
   ... 23 more


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email





Loading...