SonarQube error running main: java.lang.NoSuchMethodError: ch.qos.logback.classic.LoggerContext.initCollisionMaps()V

SonarQube error running main: java.lang.NoSuchMethodError: ch.qos.logback.classic.LoggerContext.initCollisionMaps()V

努力让 SonarQube 运行 作为一项服务。开始似乎工作:-

sudo /etc/init.d/sonar restart

Stopping SonarQube...
SonarQube was not running.
Starting SonarQube...
Started SonarQube.

但 运行我得到宁状态:-

sudo /etc/init.d/sonar status

SonarQube is not running.

在 sonar.log 中查找我在加载包装器时遇到上述错误:-

Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.


WrapperSimpleApp: Encountered an error running main: 
java.lang.NoSuchMethodError: 
ch.qos.logback.classic.LoggerContext.initCollisionMaps()V
java.lang.NoSuchMethodError: 
ch.qos.logback.classic.LoggerContext.initCollisionMaps()V
    at ch.qos.logback.classic.LoggerContext.reset(LoggerContext.java:222)
    at org.sonar.application.AppLogging.configure(AppLogging.java:128)
    at org.sonar.application.App.start(App.java:48)
    at org.sonar.application.App.main(App.java:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
    at java.lang.Thread.run(Thread.java:748)

较早的错误已解决如下

Encountered an error running main: org.sonar.process.MessageException: Directory must contain only one JAR file

(删除了 /opt/sonar/lib/common/logback-classic-1.1.3.jar 留下 /opt/sonar/lib/common/logback-classic-1.2.3.jar)

SLF4J: Class path contains multiple SLF4J bindings.re.org
SLF4J: Found binding in [jar:file:/opt/sonar/lib/common/logback-classic-
1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/sonar/lib/common/logback-classic-
1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/sonar/lib/sonar-application-
5.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an 
explanation.r!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]4j/impl/StaticLoggerBinder.class]

(删除了1.1.3版本和5.6.6版本,在common文件夹中留下7个)

不确定我现在可以做什么来让包装器记录下来,有什么想法吗?

wrapper.conf 内容

# Path to JVM executable. By default it must be available in PATH.
# Can be an absolute path, for example:
#wrapper.java.command=/path/to/my/jdk/bin/java
wrapper.java.command=/usr/lib/jvm/java-8-oracle/bin/java


#
# DO NOT EDIT THE FOLLOWING SECTIONS 
#


#********************************************************************
# Wrapper Java
#********************************************************************
wrapper.java.additional.1=-Dsonar.wrapped=true
wrapper.java.additional.2=-Djava.awt.headless=true
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.java.classpath.1=/opt/sonar/lib/jsw/*.jar
wrapper.java.classpath.2=/opt/sonar/lib/common/*.jar
wrapper.java.classpath.3=/opt/sonar/lib/*.jar
wrapper.java.library.path.1=./lib
wrapper.app.parameter.1=org.sonar.application.App
wrapper.java.initmemory=8
wrapper.java.maxmemory=32

#********************************************************************
# Wrapper Logs
#********************************************************************

wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.logfile=/opt/sonar/logs/sonar.log
wrapper.logfile.format=M
wrapper.logfile.loglevel=INFO

# Maximum size that the log file will be allowed to grow to before
#  the log is rolled. Size is specified in bytes.  The default value
#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=1m

# Maximum number of rolled log files which will be allowed before old
#  files are deleted.  The default value of 0 implies no limit.
wrapper.logfile.maxfiles=10

# Log Level for sys/event log output.  (See docs for log levels)
wrapper.syslog.loglevel=NONE

#********************************************************************
# Wrapper Windows Properties
#********************************************************************
# Title to use when running as a console
wrapper.console.title=SonarQube

# Disallow start of multiple instances of an application at the same time on Windows
wrapper.single_invocation=true

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
wrapper.ntservice.name=SonarQube

# Display name of the service
wrapper.ntservice.displayname=SonarQube

# Description of the service
wrapper.ntservice.description=SonarQube

# Service dependencies.  Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=

# Mode in which the service is installed.  AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START

# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false

#********************************************************************
# Forking Properties
#********************************************************************
wrapper.disable_restarts=TRUE
wrapper.ping.timeout=0
wrapper.shutdown.timeout=300
wrapper.jvm_exit.timeout=300

@G.Ann 我相信我使用的是 v7.0 (sonar-application-7.0.jar) 并且我已将版本 5.6.6 重命名为 sonar-application-5.6 .6.jar.sanity

补充: 我玩过这些 java 库并注意到 sonar-application-7.0.jar 文件看起来很小所以回到使用 5.6.6 我现在注意到我的日志中有一个不同的错误如下:

WrapperSimpleApp: Encountered an error running main: 
java.lang.NoSuchMethodError: org.sonar.application.AppFileSystem.<init>
(Lorg/sonar/process/Props;)V
java.lang.NoSuchMethodError: org.sonar.application.AppFileSystem.<init>
(Lorg/sonar/process/Props;)V

Google 在这个问题上根本不是很积极!

所以我想,我将设置一个新实例,看看我是否可以获得它 运行ning。我现在确实有 SonarQube 运行ning(奇怪的是这不是使用声纳用户而是这个盒子的默认用户)但是它没有加载到我的浏览器中(http://192.168.0.6:9000 remote or http://localhost:9000 在本地机器上有 sonarqube在这两种情况下都安装了 Apache2 Ubuntu Default Page (ubuntu 16.04)

查看此实例的新错误日志,我收到以下错误:

--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2018.02.27 12:35:04 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory /home/eclipse-creative/sonarqube-5.6.6/temp
2018.02.27 12:35:04 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[es]: /usr/lib/jvm/java-8-oracle/jre/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/home/eclipse-creative/sonarqube-5.6.6/temp -javaagent:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /home/eclipse-creative/sonarqube-5.6.6/temp/sq-process1825333712376294763properties
2018.02.27 12:35:04 INFO   es[o.s.p.ProcessEntryPoint]  Starting es
2018.02.27 12:35:04 INFO   es[o.s.s.EsSettings]  Elasticsearch listening on 127.0.0.1:9001
2018.02.27 12:35:04 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] version[1.7.5], pid[17427], build[00f95f4/2016-02-02T09:55:30Z]
2018.02.27 12:35:04 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] initializing ...
2018.02.27 12:35:04 INFO   es[o.e.plugins]  [sonar-1519734904274] loaded [], sites []
2018.02.27 12:35:04 INFO   es[o.elasticsearch.env]  [sonar-1519734904274] using [1] data paths, mounts [[/ (/dev/mapper/ubuntu--vg-root)]], net usable_space [191.1gb], net total_space [900.6gb], types [ext4]
2018.02.27 12:35:05 WARN   es[o.e.bootstrap]  JNA not found. native methods will be disabled.
2018.02.27 12:35:05 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] initialized
2018.02.27 12:35:05 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] starting ...
2018.02.27 12:35:06 INFO   es[o.e.transport]  [sonar-1519734904274] bound_address {inet[/127.0.0.1:9001]}, publish_address {inet[/127.0.0.1:9001]}
2018.02.27 12:35:06 INFO   es[o.e.discovery]  [sonar-1519734904274] sonarqube/5O-W5FA2RKyVQ9mwmwS25A
2018.02.27 12:35:09 INFO   es[o.e.cluster.service]  [sonar-1519734904274] new_master [sonar-1519734904274][5O-W5FA2RKyVQ9mwmwS25A][UbuntuServer6][inet[/127.0.0.1:9001]]{rack_id=sonar-1519734904274}, reason: zen-disco-join (elected_as_master)
2018.02.27 12:35:09 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] started
2018.02.27 12:35:09 INFO   es[o.e.gateway]  [sonar-1519734904274] recovered [0] indices into cluster_state
2018.02.27 12:35:09 INFO  app[o.s.p.m.Monitor] Process[es] is up
2018.02.27 12:35:09 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /usr/lib/jvm/java-8-oracle/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/home/eclipse-creative/sonarqube-5.6.6/temp -javaagent:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/home/eclipse-creative/sonarqube-5.6.6/lib/jdbc/mysql/mysql-connector-java-5.1.35.jar org.sonar.server.app.WebServer /home/eclipse-creative/sonarqube-5.6.6/temp/sq-process6145003752963374984properties
2018.02.27 12:35:09 INFO  web[o.s.p.ProcessEntryPoint] Starting web
2018.02.27 12:35:09 INFO  web[o.s.s.a.TomcatContexts] Webapp directory: /home/eclipse-creative/sonarqube-5.6.6/web
2018.02.27 12:35:10 INFO  web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-192.168.0.6-9000"]
2018.02.27 12:35:10 ERROR web[o.a.c.h.Http11NioProtocol] Failed to initialize end point associated with ProtocolHandler ["http-nio-192.168.0.6-9000"]
java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_161]
    at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_161]
    at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_161]
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_161]
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_161]
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:742) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:458) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:120) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:960) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:136) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:345) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:62) [sonar-server-5.6.6.jar:na]
    at org.sonar.server.app.WebServer.start(WebServer.java:42) [sonar-server-5.6.6.jar:na]
    at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:102) [sonar-process-5.6.6.jar:na]
    at org.sonar.server.app.WebServer.main(WebServer.java:68) [sonar-server-5.6.6.jar:na]
2018.02.27 12:35:10 ERROR web[o.a.c.c.StandardService] Failed to initialize connector [Connector[HTTP/1.1-9000]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-9000]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:136) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:345) [tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:62) [sonar-server-5.6.6.jar:na]
    at org.sonar.server.app.WebServer.start(WebServer.java:42) [sonar-server-5.6.6.jar:na]
    at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:102) [sonar-process-5.6.6.jar:na]
    at org.sonar.server.app.WebServer.main(WebServer.java:68) [sonar-server-5.6.6.jar:na]
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:962) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) [tomcat-embed-core-8.0.32.jar:8.0.32]
    ... 10 common frames omitted
Caused by: java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_161]
    at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_161]
    at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_161]
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_161]
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.8.0_161]
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:742) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:458) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:120) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:960) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    ... 11 common frames omitted
2018.02.27 12:35:10 WARN  web[o.s.p.ProcessEntryPoint] Fail to start web
java.lang.RuntimeException: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]]
    at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:na]
    at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:65) ~[sonar-server-5.6.6.jar:na]
    at org.sonar.server.app.WebServer.start(WebServer.java:42) [sonar-server-5.6.6.jar:na]
    at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:102) ~[sonar-process-5.6.6.jar:na]
    at org.sonar.server.app.WebServer.main(WebServer.java:68) [sonar-server-5.6.6.jar:na]
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:136) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:345) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:62) ~[sonar-server-5.6.6.jar:na]
    ... 3 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [StandardService[Tomcat]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    ... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9000]]
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:575) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
    ... 8 common frames omitted
2018.02.27 12:35:10 INFO  app[o.s.p.m.Monitor] Process[es] is stopping
2018.02.27 12:35:10 INFO   es[o.s.p.StopWatcher]  Stopping process
2018.02.27 12:35:10 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] stopping ...
2018.02.27 12:35:10 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] stopped
2018.02.27 12:35:10 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] closing ...
2018.02.27 12:35:10 INFO   es[o.elasticsearch.node]  [sonar-1519734904274] closed
2018.02.27 12:35:11 INFO  app[o.s.p.m.Monitor] Process[es] is stopped
<-- Wrapper Stopped

我在这个实例上使用的是 apache,所以不确定为什么要引用 tomcat。我的声纳 apache conf 文件是:

ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:80>  
    ServerName 192.168.0.6/sonar
    ServerAlias sonar.ecl
    ServerAdmin c.stanfield@eclipse-creative.com
    ProxyPreserveHost On
    ProxyPass / http://localhost:9000/
    ProxyPassReverse / http://localhost:9000/
    CustomLog /var/log/apache2/sonar.ecl_access.log common
    ErrorLog /var/log/apache2/sonar.ecl_error.log
</VirtualHost>

甚至不确定我是否真的需要反向代理?

场景是这样的,我们在这个盒子上安装了 jenkins 运行ning 并计划在部署过程中使用声纳检查代码服务器在我们的工作内部网上并且不向外(通过 ssh 或这样)我们希望能够查看失败构建的声纳结果(通过 slack 通知我们通过 jenkins 工作)这样我们网络中另一台机器上的用户将请求 http://192.168.0.6:9000 访问声纳和查看阻止部署的任何问题。这个我想最多是怎么用sonar的? java 不是我的强项来自 c++ 和 php 背景

克雷格

您似乎已尝试通过有选择地替换旧版本中的部分来就地执行升级。需要明确的是:那是不是升级的方式

当您从一个版本升级到另一个版本时,您应该用旧版本展开新版本的 zip side-by-side。将 values 从旧配置文件复制到新配置文件。 也许 复制插件 - 再次从旧 版本到新版本。关闭旧的并启动新的。您必须告诉 SonarQube 升级其数据库(如 the Upgrade instructions 中所述)。就是这样。