sonar-scanner运行报错

发布于 2021-12-08 14:24:14 字数 185 浏览 1076 评论 10

项目配置好了 执行sonar-scanner报错,求大神指教,版本是sonar5.5 scanner2.6

红薯大神快来解救@红薯

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

背叛残局 2021-12-08 21:30:24

SonarQube Runner 2.4
Java 1.8.0_141 Oracle Corporation (64-bit)
Linux 3.10.0-693.2.2.el7.x86_64 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: /usr/local/sonar-runner-2.4/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /usr/local/sonar-runner-2.4/bin/./.sonar
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 30.167s
Final Memory: 1M/29M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.kevinsawicki.HttpRequest$HttpRequestException: java.net.SocketTimeoutException: connect timed out
    at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1392)
    at org.sonar.runner.kevinsawicki.HttpRequest.ok(HttpRequest.java:1417)
    at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:93)
    at org.sonar.runner.impl.ServerVersion.downloadVersion(ServerVersion.java:47)
    at org.sonar.runner.impl.ServerVersion.version(ServerVersion.java:38)
    at org.sonar.runner.impl.ServerVersion.is37Compatible(ServerVersion.java:58)
    at org.sonar.runner.impl.JarDownloader.checkVersionAndDownload(JarDownloader.java:36)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:71)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:100)
    at org.sonar.runner.Main.executeTask(Main.java:70)
    at org.sonar.runner.Main.execute(Main.java:59)
    at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.net.SocketTimeoutException: connect timed out
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1390)
    ... 15 more
Caused by: java.net.SocketTimeoutException: connect timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:357)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2982)
    at org.sonar.runner.kevinsawicki.HttpRequest.header(HttpRequest.java:1903)
    at org.sonar.runner.kevinsawicki.HttpRequest.contentType(HttpRequest.java:2308)
    at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:89)
    ... 13 more
 

策马西风 2021-12-08 21:28:46

@Yashin 已经在项目里配置了 运行还是报错上面那个错

顾挽 2021-12-08 21:12:49
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must define the following mandatory properties for 'Unknow
n': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with t
he -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
@Yashin 报错信息
心欲静而疯不止 2021-12-08 21:04:47

@Yashin 大神runner运行需要配上项目?

柠檬 2021-12-08 20:43:21

sonar stop 然后把数据库清空了,再sonar star。出现这个的原因可能是你首次启动sonar web的时候启动失败,但却把数据库表建起来了。

凯凯我们等你回来 2021-12-08 20:40:16

2016.05.25 09:36:04 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.RubyRailsContextListener

org.jruby.rack.RackInitializationException: ActiveRecord::JDBCError: Tablespace for table '`sonar`.`schema_migrations`' exists. Please DISCARD the tablespace before IMPORT.: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `create_table'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/mysql/adapter.rb:252:in `create_table'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:371:in `initialize_schema_migrations_table'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441:in `initialize'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in `up'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:in `migrate'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/config/../lib/database_version.rb:66:in `upgrade_and_start'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/config/../lib/database_version.rb:77:in `automatic_setup'

    from E:/Sonra/sonarqube-5.5/web/WEB-INF/config/environment.rb:306:in `(root)'

    from org/jruby/RubyKernel.java:1094:in `load'

    from file:/E:/Sonra/sonarqube-5.5/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1:in `(root)'

    from file:/E:/Sonra/sonarqube-5.5/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25:in `load_environment'

    from file:/E:/Sonra/sonarqube-5.5/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79:in `load_environment'

    at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:29) ~[jruby-rack-1.1.13.2.jar:na]

    at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:98) ~[jruby-rack-1.1.13.2.jar:na]

    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50) ~[jruby-rack-1.1.13.2.jar:na]

    at org.sonar.server.platform.RubyRailsContextListener.contextInitialized(RubyRailsContextListener.java:38) ~[sonar-server-5.5.jar:na]

    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812) [tomcat-embed-core-8.0.30.jar:8.0.30]

    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255) [tomcat-embed-core-8.0.30.jar:8.0.30]

    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.30.jar:8.0.30]

    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [tomcat-embed-core-8.0.30.jar:8.0.30]

    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [tomcat-embed-core-8.0.30.jar:8.0.30]

    at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_91]

    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_91]

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_91]

    at java.lang.Thread.run(Unknown Source) [na:1.8.0_91]

Caused by: org.jruby.exceptions.RaiseException: (StatementInvalid) ActiveRecord::JDBCError: Tablespace for table '`sonar`.`schema_migrations`' exists. Please DISCARD the tablespace before IMPORT.: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin

    at RUBY.log(E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227) ~[na:na]

    at RUBY.execute(E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183) ~[na:na]

    at RUBY.create_table(E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109) ~[na:na]

    at RUBY.create_table(E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/mysql/adapter.rb:252) ~[na:na]

    at RUBY.initialize_schema_migrations_table(E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:371) ~[na:na]

    at RUBY.initialize(E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441) ~[na:na]

    at RUBY.up(E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401) ~[na:na]

    at RUBY.migrate(E:/Sonra/sonarqube-5.5/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383) ~[na:na]

    at RUBY.upgrade_and_start(E:/Sonra/sonarqube-5.5/web/WEB-INF/config/../lib/database_version.rb:66) ~[na:na]

    at RUBY.automatic_setup(E:/Sonra/sonarqube-5.5/web/WEB-INF/config/../lib/database_version.rb:77) ~[na:na]

    at RUBY.(root)(E:/Sonra/sonarqube-5.5/web/WEB-INF/config/environment.rb:306) ~[na:na]

    at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1094) ~[jruby-complete-1.7.9.jar:na]

    at RUBY.(root)(file:/E:/Sonra/sonarqube-5.5/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1) ~[na:na]

    at RUBY.load_environment(file:/E:/Sonra/sonarqube-5.5/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25) ~[na:na]

    at RUBY.load_environment(file:/E:/Sonra/sonarqube-5.5/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79) ~[na:na]

2016.05.25 09:36:04 ERROR web[o.a.c.c.StandardContext] One or more listeners failed to start. Full details will be found in the appropriate container log file

2016.05.25 09:36:04 ERROR web[o.a.c.c.StandardContext] Context [] startup failed due to previous errors

2016.05.25 09:36:04 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

 java.lang.Object.wait(Native Method)

 java.lang.ref.ReferenceQueue.remove(Unknown Source)

 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)

2016.05.25 09:36:04 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [JRubyJIT-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

 sun.misc.Unsafe.park(Native Method)

 java.util.concurrent.locks.LockSupport.park(Unknown Source)

 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)

 java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)

 java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)

 java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

 java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

 java.lang.Thread.run(Unknown Source)

2016.05.25 09:36:04 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [JRubyJIT-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

 sun.misc.Unsafe.park(Native Method)

 java.util.concurrent.locks.LockSupport.park(Unknown Source)

 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)

 java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)

 java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)

 java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

 java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

 java.lang.Thread.run(Unknown Source)

2016.05.25 09:36:04 INFO  web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]

2016.05.25 09:36:05 INFO  web[o.s.s.a.TomcatAccessLog] Web server is started

2016.05.25 09:36:05 INFO  web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000

2016.05.25 09:36:05 WARN  web[o.s.p.ProcessEntryPoint] Fail to start web

java.lang.IllegalStateException: Webapp did not start

    at org.sonar.server.app.EmbeddedTomcat.isUp(EmbeddedTomcat.java:84) ~[sonar-server-5.5.jar:na]

    at org.sonar.server.app.WebServer.isUp(WebServer.java:48) [sonar-server-5.5.jar:na]

    at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:105) ~[sonar-process-5.5.jar:na]

    at org.sonar.server.app.WebServer.main(WebServer.java:69) [sonar-server-5.5.jar:na]

2016.05.25 09:36:05 INFO  web[o.a.c.h.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-0.0.0.0-9000"]

2016.05.25 09:36:06 INFO  web[o.a.c.h.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-0.0.0.0-9000"]

2016.05.25 09:36:06 INFO  web[o.a.c.h.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-0.0.0.0-9000"]

2016.05.25 09:36:06 INFO  web[o.s.s.a.TomcatAccessLog] Web server is stopped

Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=160m; support was removed in 8.0

2016.05.25 09:36:06 INFO  app[o.s.p.m.Monitor] Process[es] is stopping

2016.05.25 09:36:06 INFO   es[o.s.p.StopWatcher]  Stopping process

2016.05.25 09:36:06 INFO   es[o.elasticsearch.node]  [sonar-1464140116077] stopping ...

2016.05.25 09:36:06 INFO   es[o.elasticsearch.node]  [sonar-1464140116077] stopped

2016.05.25 09:36:06 INFO   es[o.elasticsearch.node]  [sonar-1464140116077] closing ...

2016.05.25 09:36:06 INFO   es[o.elasticsearch.node]  [sonar-1464140116077] closed

2016.05.25 09:36:07 INFO  app[o.s.p.m.Monitor] Process[es] is stopped

<-- Wrapper Stopped

@Yashin 大神 为什么会报这个错误呢?刚开始的时候只是建个数据库而已 里面根本就没有表的

倾城泪 2021-12-08 20:34:07

Re-run SonarQube Scanner using the -X switch to enable full debug logging。 看看详细日志啊,看起来是无法从sonar web server下载插件,也看看 web server的日志 Sonar/log/sonar.log

绝影如岚 2021-12-08 20:31:18

INFO: Project root configuration file: NONE

INFO: SonarQube Scanner 2.6.1

INFO: Java 1.8.0_91 Oracle Corporation (32-bit)

INFO: Windows 7 6.1 x86

INFO: User cache: C:UsersAdministrator.sonarcache

ERROR: SonarQube server [http://localhost:9000] can not be reached

INFO: ------------------------------------------------------------------------

INFO: EXECUTION FAILURE

INFO: ------------------------------------------------------------------------

INFO: Total time: 5.414s

INFO: Final Memory: 2M/15M

INFO: ------------------------------------------------------------------------

ERROR: Error during SonarQube Scanner execution

ERROR: Unable to execute SonarQube

ERROR: Caused by: Fail to download libraries from server

ERROR: Caused by: Connection refused: connect

ERROR:

ERROR: To see the full stack trace of the errors, re-run SonarQube Scanner with

the -e switch.

ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging。

@Yashin 大神看看这个错误提示

回眸一笑 2021-12-08 15:26:36

错误日志得贴出来吧

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文