Sonar Response Code 500

204 views
Skip to first unread message

soma srikanth

unread,
Oct 7, 2016, 2:20:04 PM10/7/16
to SonarQube
this is what i see in my sonar logs after running analysis from jenkins i ran this job after i made changes to sonar db that is updating new group id to the old group id of the project below is the following query i used 

SQL QUERY
set sql_safe_updates=0;
update projects
set kee = replace(kee,'nl.foo','nl.bar')

Jenkins output says this :

[INFO] --- sonar-maven-plugin:3.0.1:sonar (default-cli) @ ece-services ---
[INFO] User cache: /var/lib/jenkins/.sonar/cache
[INFO] SonarQube version: 5.1.2
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] [17:48:11.813] Load global repositories
[INFO] [17:48:11.909] Load global repositories (done) | time=98ms
[INFO] [17:48:11.911] Server id: 20161007140318
[INFO] [17:48:11.913] User cache: /var/lib/jenkins/.sonar/cache
[INFO] [17:48:11.919] Install plugins
[INFO] [17:48:12.062] Install JDBC driver
[INFO] [17:48:12.070] Create JDBC datasource for jdbc:sonar.jdbc.url:3306/sonar?rewriteBatchedStatements=true
[INFO] [17:48:13.310] Initializing Hibernate
[INFO] [17:48:14.957] Load project repositories
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.579 s
[INFO] Finished at: 2016-10-07T17:48:14+00:00
[INFO] Final Memory: 48M/456M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project ece-services: Fail to execute request [code=500, url=http://sonar.host.url/batch/project?key=group id:artifact id &preview=false]: Fail to download [http://sonar.host.url/batch/project?key=groupid:artifactids&preview=false]. Response code: 500 -> [Help 1]
[ERROR] 

Sonar Logs:

2016.10.07 03:40:52 ERROR web[o.s.s.w.WebServiceEngine] Fail to process request http://sonar.host.url/batch/project?key=com.project%3Aproject-name&preview=false
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:70) ~[mybatis-3.2.7.jar:3.2.7]
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68) ~[mybatis-3.2.7.jar:3.2.7]
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) ~[mybatis-3.2.7.jar:3.2.7]
        at com.sun.proxy.$Proxy86.selectByKey(Unknown Source) ~[na:na]
        at org.sonar.server.component.db.ComponentDao.doGetNullableByKey(ComponentDao.java:145) ~[sonar-server-5.1.2.jar:na]
        at org.sonar.server.component.db.ComponentDao.doGetNullableByKey(ComponentDao.java:47) ~[sonar-server-5.1.2.jar:na]
        at org.sonar.server.db.BaseDao.getNullableByKey(BaseDao.java:158) ~[sonar-server-5.1.2.jar:na]
        at org.sonar.server.batch.ProjectRepositoryLoader.load(ProjectRepositoryLoader.java:91) ~[sonar-server-5.1.2.jar:na]
        at org.sonar.server.batch.ProjectRepositoryAction.handle(ProjectRepositoryAction.java:70) ~[sonar-server-5.1.2.jar:na]
        at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:84) ~[sonar-server-5.1.2.jar:na]
        at sun.reflect.GeneratedMethodAccessor201.invoke(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_74]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_74]
        at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:425) [jruby-complete-1.7.9.jar:na]
        at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:292) [jruby-complete-1.7.9.jar:na]
        at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:44) [jruby-complete-1.7.9.jar:na]
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70) [jruby-complete-1.7.9.jar:na]
        at rubyjit.Api::JavaWsController$$index_18AF0797CD66B4E310384A14E2B9EE369902E67F1929572029.__file__(/opt/sonar/web/WEB-INF/app/controllers/api/java_ws_controller.rb:30) [jruby-complete-1.7.9.jar:na]
        at rubyjit.Api::JavaWsController$$index_18AF0797CD66B4E310384A14E2B9EE369902E67F1929572029.__file__(/opt/sonar/web/WEB-INF/app/controllers/api/java_ws_controller.rb) [jruby-complete-1.7.9.jar:na]
        at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:161) [jruby-complete-1.7.9.jar:na]
        at org.jruby.RubyClass.finvoke(RubyClass.java:527) [jruby-complete-1.7.9.jar:na]
        at org.jruby.RubyBasicObject.send(RubyBasicObject.java:2590) [jruby-complete-1.7.9.jar:na]
        at org.jruby.RubyKernel.send(RubyKernel.java:2223) [jruby-complete-1.7.9.jar:na]
        at org.jruby.RubyKernel$INVOKER$s$send.call(RubyKernel$INVOKER$s$send.gen) [jruby-complete-1.7.9.jar:na]
        at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:350) [jruby-complete-1.7.9.jar:na]
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326) [jruby-complete-1.7.9.jar:na]
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170) [jruby-complete-1.7.9.jar:na]
        at rubyjit.ActionController::Base$$perform_action_DA0FC0A901DD1257EC969DB0C482DD8514B8F04B1929572029.__file__(/opt/sonar/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:1333) [jruby-complete-1.7.9.jar:na]
        at rubyjit.ActionController::Base$$perform_action_DA0FC0A901DD1257EC969DB0C482DD8514B8F04B1929572029.__file__(/opt/sonar/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb) [jruby-complete-1.7.9.jar:na]
        at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:141) [jruby-complete-1.7.9.jar:na]
        at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:185) [jruby-complete-1.7.9.jar:na]
        at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:56) [jruby-complete-1.7.9.jar:na]
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306) [jruby-complete-1.7.9.jar:na]

Simon Brandhof

unread,
Oct 10, 2016, 4:11:34 AM10/10/16
to soma srikanth, SonarQube
Hi,

As already mentioned many times on this group, touching the database is not recommended at all. In your case the UPDATE request corrupted the model. A db backup should be restored.

Regards

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/b1dba518-61ea-48f8-b8ef-5493ebe57766%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Simon BRANDHOF | SonarSource
Tech Lead & Co-Founder
http://twitter.com/SimonBrandhof
Reply all
Reply to author
Forward
0 new messages