gpt4 book ai didi

java - SonarQube 运行 main : java. lang.NoSuchMethodError : ch. qos.logback.classic.LoggerContext.initCollisionMaps()V 时出错

转载 作者:行者123 更新时间:2023-11-30 06:16:53 26 4
gpt4 key购买 nike

努力让 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 版本,在公共(public)文件夹中留下 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 在这个问题上根本就没有很积极的态度!

所以我想,我将设置一个新实例,看看是否可以让它运行。我现在确实有 SonarQube 正在运行(奇怪的是,这不是使用 Sonar 用户,而是此框的默认用户),但它没有在我的浏览器中加载( http://192.168.0.6:9000 远程或 http://localhost:9000 在安装了 sonarqube 的本地计算机上这两种情况我们都以 Apache2 Ubuntu 默认页面 (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。我的 Sonar 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 ,并计划在部署过程中使用 Sonar 来检查代码,服务器位于我们的工作内联网上,并且不是面向外部的(通过 ssh 或类似方式)我们希望能够查看失败构建的 Sonar 结果(通过 slack 通知我们通过 jenkins 进行工作),以便我们网络中另一台计算机上的用户向 http://192.168.0.6:9000 发出请求访问 Sonar 并查看阻止部署的任何问题。我想这就是大多数使用 Sonar 的方式? java 不是我的强项,因为我有 C++ 和 php 背景

克雷格

最佳答案

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

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

关于java - SonarQube 运行 main : java. lang.NoSuchMethodError : ch. qos.logback.classic.LoggerContext.initCollisionMaps()V 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48991898/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com