SonarQube /api/resources - 500 内部服务器错误
SonarQube /api/resources - 500 Internal Server Error
我在 Jenkins 上使用 [slack-sonar-pusher][1],但是当我 运行 作业时,我得到了这个输出:
[ssp] Calling SonarQube on: http://xxx.xxx.x.xx:9000/api/resources?metrics=alert_status,quality_gate_details&includealerts=true
[ssp] Got a non 200 response from SonarQube. Server responded with '500 : Internal Server Error'
[ssp] Could not get Sonar results, exception: 'null'
Build step 'Sonar Slack pusher' marked build as failure
如果我直接在浏览器中打开http://xxx.xxx.x.xx:9000/api/resources?metrics=alert_status,quality_gate_details&includealerts=true url,我收到了正确的内容:
<resource>
<id>1</id>
<key>xxxxxx</key>
<name>xxxxx</name>
<lname>xxxxx</lname>
<scope>PRJ</scope>
<qualifier>TRK</qualifier>
<version>1.0</version>
<date>2016-04-15T17:54:33+0200</date>
<creationDate>2016-04-13T18:15:34+0200</creationDate>
<msr>
<key>alert_status</key>
<data>ERROR</data>
<alert>ERROR</alert>
<alert_text>
New Blocker issues > 0 since previous version (2016 Apr 13), New Critical issues > 20 since previous version (2016 Apr 13)
</alert_text>
</msr>
<msr>
<key>quality_gate_details</key>
<data>
{"level":"ERROR","conditions":[{"metric":"new_blocker_violations","op":"GT","period":1,"error":"0","actual":"3","level":"ERROR"},{"metric":"new_critical_violations","op":"GT","period":1,"warning":"","error":"20","actual":"71","level":"ERROR"},{"metric":"new_sqale_debt_ratio","op":"GT","period":1,"error":"5","actual":"0.0","level":"OK"}]}
</data>
</msr>
</resource>
Sonar.log
2016.04.15 19:07:39 ERROR web[o.s.s.ui.JRubyFacade] Fail to render: http://xxx.xx.x.xxx:9000/api/resources?metrics=alert_status,quality_gate_details&includealerts=true
undefined method `generate' for #<JSON::Ext::Generator::State:0x6157370a>
/Users/Jenkins/.calabash/calabash-gems/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
/Users/Jenkins/.calabash/calabash-gems/gems/json-1.8.3/lib/json/common.rb:470:in `JSON'
/private/etc/sonarqube-5.4/web/WEB-INF/app/controllers/api/api_controller.rb:48:in `jsonp'
/private/etc/sonarqube-5.4/web/WEB-INF/app/controllers/api/api_controller.rb:132:in `error_to_json'
/private/etc/sonarqube-5.4/web/WEB-INF/app/controllers/api/api_controller.rb:123:in `render_response'
org/jruby/RubyProc.java:290:in `call'
org/jruby/RubyProc.java:224:in `call'
有人知道问题出在哪里吗?
已解决:
unset GEM_PATH
unset GEM_HOME
我在 Jenkins 上使用 [slack-sonar-pusher][1],但是当我 运行 作业时,我得到了这个输出:
[ssp] Calling SonarQube on: http://xxx.xxx.x.xx:9000/api/resources?metrics=alert_status,quality_gate_details&includealerts=true
[ssp] Got a non 200 response from SonarQube. Server responded with '500 : Internal Server Error'
[ssp] Could not get Sonar results, exception: 'null'
Build step 'Sonar Slack pusher' marked build as failure
如果我直接在浏览器中打开http://xxx.xxx.x.xx:9000/api/resources?metrics=alert_status,quality_gate_details&includealerts=true url,我收到了正确的内容:
<resource>
<id>1</id>
<key>xxxxxx</key>
<name>xxxxx</name>
<lname>xxxxx</lname>
<scope>PRJ</scope>
<qualifier>TRK</qualifier>
<version>1.0</version>
<date>2016-04-15T17:54:33+0200</date>
<creationDate>2016-04-13T18:15:34+0200</creationDate>
<msr>
<key>alert_status</key>
<data>ERROR</data>
<alert>ERROR</alert>
<alert_text>
New Blocker issues > 0 since previous version (2016 Apr 13), New Critical issues > 20 since previous version (2016 Apr 13)
</alert_text>
</msr>
<msr>
<key>quality_gate_details</key>
<data>
{"level":"ERROR","conditions":[{"metric":"new_blocker_violations","op":"GT","period":1,"error":"0","actual":"3","level":"ERROR"},{"metric":"new_critical_violations","op":"GT","period":1,"warning":"","error":"20","actual":"71","level":"ERROR"},{"metric":"new_sqale_debt_ratio","op":"GT","period":1,"error":"5","actual":"0.0","level":"OK"}]}
</data>
</msr>
</resource>
Sonar.log
2016.04.15 19:07:39 ERROR web[o.s.s.ui.JRubyFacade] Fail to render: http://xxx.xx.x.xxx:9000/api/resources?metrics=alert_status,quality_gate_details&includealerts=true
undefined method `generate' for #<JSON::Ext::Generator::State:0x6157370a>
/Users/Jenkins/.calabash/calabash-gems/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
/Users/Jenkins/.calabash/calabash-gems/gems/json-1.8.3/lib/json/common.rb:470:in `JSON'
/private/etc/sonarqube-5.4/web/WEB-INF/app/controllers/api/api_controller.rb:48:in `jsonp'
/private/etc/sonarqube-5.4/web/WEB-INF/app/controllers/api/api_controller.rb:132:in `error_to_json'
/private/etc/sonarqube-5.4/web/WEB-INF/app/controllers/api/api_controller.rb:123:in `render_response'
org/jruby/RubyProc.java:290:in `call'
org/jruby/RubyProc.java:224:in `call'
有人知道问题出在哪里吗?
已解决:
unset GEM_PATH
unset GEM_HOME