Sonarqube 无法连接到 PostgreSQL
Sonarqube could not connect to PostgreSQL
我正在尝试将 Sonarqube 连接到 PostgreSQL,但它在启动时抛出以下错误。
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2015.05.06 17:47:45 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[search]: /usr/lib/jvm/java-7-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=/ssd/sonar/sonarqube-5.1/temp -cp ./lib/common/*:./lib/search*/ org.sonar.search.SearchServer /tmp/sq-process1977113005492303949properties
2015.05.06 17:47:45 INFO es[o.s.p.ProcessEntryPoint] Starting search
2015.05.06 17:47:45 INFO es[o.s.s.SearchServer] Starting Elasticsearch[sonarqube] on port 9001
2015.05.06 17:47:46 INFO es[o.elasticsearch.node] [sonar-1430945265510] version[1.4.4], pid[13920], build[c88f77f/2015-02-19T13:05:36Z]
2015.05.06 17:47:46 INFO es[o.elasticsearch.node] [sonar-1430945265510] initializing ...
2015.05.06 17:47:46 INFO es[o.e.plugins] [sonar-1430945265510] loaded [], sites []
2015.05.06 17:47:47 INFO es[o.elasticsearch.node] [sonar-1430945265510] initialized
2015.05.06 17:47:47 INFO es[o.elasticsearch.node] [sonar-1430945265510] starting ...
2015.05.06 17:47:47 INFO es[o.e.transport] [sonar-1430945265510] bound_address {inet[/0.0.0.0:9001]}, publish_address {inet[/192.168.0.30:9001]}
2015.05.06 17:47:47 INFO es[o.e.discovery] [sonar-1430945265510] sonarqube/jY5aYsfmTVW5G1BE521uBg
2015.05.06 17:47:50 INFO es[o.e.cluster.service] [sonar-1430945265510] new_master [sonar-1430945265510][jY5aYsfmTVW5G1BE521uBg][OobjTestServer][inet[/192.168.0.30:9001]]{rack_id=sonar-1430945265510}, reason: zen-disco-join (elected_as_master)
2015.05.06 17:47:50 INFO es[o.elasticsearch.node] [sonar-1430945265510] started
2015.05.06 17:47:50 INFO es[o.e.gateway] [sonar-1430945265510] recovered [0] indices into cluster_state
2015.05.06 17:47:50 INFO app[o.s.p.m.Monitor] Process[search] is up
2015.05.06 17:47:50 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /usr/lib/jvm/java-7-oracle/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/ssd/sonar/sonarqube-5.1/temp -cp ./lib/common/*:./lib/server*/:/ssd/sonar/sonarqube-5.1/lib/jdbc/postgresql/postgresql-9.3-1102-jdbc41.jar org.sonar.server.app.WebServer /tmp/sq-process3509085435217188319properties
2015.05.06 17:47:50 INFO web[o.s.p.ProcessEntryPoint] Starting web
2015.05.06 17:47:51 INFO web[o.s.s.app.Webapp] Webapp directory: /ssd/sonar/sonarqube-5.1/web
2015.05.06 17:47:51 INFO web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:51 INFO web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2015.05.06 17:47:51 INFO web[o.e.plugins] [sonar-1430945265510] loaded [], sites []
2015.05.06 17:47:52 INFO web[o.s.s.p.ServerImpl] SonarQube Server / 5.1 / 4aa9af3a6a4362b61db365fba32eb0a55d411e7a
2015.05.06 17:47:52 INFO web[o.s.c.p.Database] Create JDBC datasource for jdbc:postgresql://localhost/sonarqube
2015.05.06 17:47:52 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:117) ~[sonar-core-5.1.jar:na]
at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:73) ~[sonar-core-5.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_76]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766) ~[picocontainer-2.14.3.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91) ~[sonar-plugin-api-5.1.jar:na]
at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:96) ~[sonar-server-5.1.jar:na]
at org.sonar.server.platform.Platform.init(Platform.java:72) ~[sonar-server-5.1.jar:na]
at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43) ~[sonar-server-5.1.jar:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4720) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) [tomcat-embed-core-8.0.18.jar:8.0.18]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_76]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_76]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_76]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_76]
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Conexão negada. Verifique se o nome da máquina e a porta estão corretos e se o postmaster está aceitando conexões TCP/IP.)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:115) ~[sonar-core-5.1.jar:na]
... 27 common frames omitted
Caused by: org.postgresql.util.PSQLException: Conexão negada. Verifique se o nome da máquina e a porta estão corretos e se o postmaster está aceitando conexões TCP/IP.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:215) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:144) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.Driver.makeConnection(Driver.java:410) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.Driver.connect(Driver.java:280) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ~[commons-dbcp-1.4.jar:1.4]
... 30 common frames omitted
Caused by: java.net.ConnectException: Conexão recusada
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.7.0_76]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) ~[na:1.7.0_76]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) ~[na:1.7.0_76]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) ~[na:1.7.0_76]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.7.0_76]
at java.net.Socket.connect(Socket.java:579) ~[na:1.7.0_76]
at org.postgresql.core.PGStream.<init>(PGStream.java:61) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:109) ~[postgresql-9.3-1102-jdbc41.jar:na]
... 42 common frames omitted
2015.05.06 17:47:52 INFO web[jruby.rack] jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.7.0_76-b13 [linux-amd64]
2015.05.06 17:47:52 INFO web[jruby.rack] using a shared (threadsafe!) runtime
2015.05.06 17:47:56 ERROR web[jruby.rack] initialization failed
org.jruby.rack.RackInitializationException: java.lang.NullPointerException
at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:31) ~[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.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4720) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) [tomcat-embed-core-8.0.18.jar:8.0.18]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_76]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_76]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_76]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_76]
Caused by: java.lang.NullPointerException: null
at org.sonar.server.ui.JRubyFacade.get(JRubyFacade.java:77) ~[sonar-server-5.1.jar:na]
at org.sonar.server.ui.JRubyFacade.getDatabase(JRubyFacade.java:209) ~[sonar-server-5.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_76]
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.IfNode.interpret(IfNode.java:118) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.rack.DefaultRackApplicationFactory.create(DefaultRackApplicationFactory.java:98) ~[jruby-rack-1.1.13.2.jar:na]
at org.jruby.rack.DefaultRackApplicationFactory$RackApplicationImpl.init(DefaultRackApplicationFactory.java:420) ~[jruby-rack-1.1.13.2.jar:na]
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:111) ~[jruby-rack-1.1.13.2.jar:na]
at org.jruby.rack.SharedRackApplicationFactory.doInit(SharedRackApplicationFactory.java:31) ~[jruby-rack-1.1.13.2.jar:na]
at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:94) ~[jruby-rack-1.1.13.2.jar:na]
... 10 common frames omitted
2015.05.06 17:47:56 ERROR web[o.a.c.c.StandardContext] Error listenerStart
2015.05.06 17:47:56 ERROR web[o.a.c.c.StandardContext] Context [] startup failed due to previous errors
2015.05.06 17:47:56 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Timer-0] 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.util.TimerThread.mainLoop(Timer.java:552)
java.util.TimerThread.run(Timer.java:505)
2015.05.06 17:47:56 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(LockSupport.java:186)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
2015.05.06 17:47:56 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(LockSupport.java:186)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
2015.05.06 17:47:56 INFO web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:56 INFO web[o.s.s.a.TomcatAccessLog] Web server is started
2015.05.06 17:47:56 INFO web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2015.05.06 17:47:56 WARN web[o.s.p.ProcessEntryPoint] Fail to start web
java.lang.IllegalStateException: Webapp did not start
at org.sonar.server.app.EmbeddedTomcat.isReady(EmbeddedTomcat.java:84) ~[sonar-server-5.1.jar:na]
at org.sonar.server.app.WebServer.isReady(WebServer.java:45) [sonar-server-5.1.jar:na]
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:80) ~[sonar-process-5.1.jar:na]
at org.sonar.server.app.WebServer.main(WebServer.java:66) [sonar-server-5.1.jar:na]
2015.05.06 17:47:56 INFO web[o.a.c.h.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:57 INFO web[o.a.c.h.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:57 INFO web[o.a.c.h.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:57 INFO web[o.s.s.a.TomcatAccessLog] Web server is stopped
2015.05.06 17:47:57 INFO app[o.s.p.m.TerminatorThread] Process[search] is stopping
2015.05.06 17:47:57 INFO es[o.s.p.StopWatcher] Stopping process
2015.05.06 17:47:57 INFO es[o.elasticsearch.node] [sonar-1430945265510] stopping ...
2015.05.06 17:47:57 INFO es[o.elasticsearch.node] [sonar-1430945265510] stopped
2015.05.06 17:47:57 INFO es[o.elasticsearch.node] [sonar-1430945265510] closing ...
2015.05.06 17:47:57 INFO es[o.elasticsearch.node] [sonar-1430945265510] closed
2015.05.06 17:47:58 INFO app[o.s.p.m.TerminatorThread] Process[search] is stopped
所以我检查了用户凭据(属性前缀为sonar.jdbc),一切正常。用户 sonarqube 被创建到数据库中。有人可以帮忙吗?
这是 sonar.properties 文件:
# This file must contain only ISO 8859-1 characters.
# See http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
#
# Property values can:
# - reference an environment variable, for example sonar.jdbc.url= ${env:SONAR_JDBC_URL}
# - be encrypted. See http://docs.codehaus.org/display/SONAR/Settings+Encryption
#--------------------------------------------------------------------------------------------------
# DATABASE
#
# IMPORTANT: the embedded H2 database is used by default. It is recommended for tests but not for
# production use. Supported databases are MySQL, Oracle, PostgreSQL and Microsoft SQLServer.
# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=sonarqube
sonar.jdbc.password=sonarqube
#----- Embedded Database (default)
# It does not accept connections from remote hosts, so the
# server and the analyzers must be executed on the same host.
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092
#----- MySQL 5.x
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
#----- Oracle 10g/11g
# - Only thin client is supported
# - Only versions 11.2.* of Oracle JDBC driver are supported, even if connecting to lower Oracle versions.
# - The JDBC driver must be copied into the directory extensions/jdbc-driver/oracle/
# - If you need to set the schema, please refer to http://jira.codehaus.org/browse/SONAR-5000
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE
#----- PostgreSQL 8.x/9.x
# If you don't use the schema named "public", please refer to http://jira.codehaus.org/browse/SONAR-5000
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#----- Microsoft SQLServer 2005/2008
# Only the distributed jTDS driver is supported.
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
#----- Connection pool settings
sonar.jdbc.maxActive=20
sonar.jdbc.maxIdle=5
sonar.jdbc.minIdle=2
sonar.jdbc.maxWait=5000
sonar.jdbc.minEvictableIdleTimeMillis=600000
sonar.jdbc.timeBetweenEvictionRunsMillis=30000
#--------------------------------------------------------------------------------------------------
# WEB SERVER
# Web server is executed in a dedicated Java process. By default its heap size is 768Mb.
# Use the following property to customize JVM options. Enabling the HotSpot Server VM
# mode (-server) is recommended.
# Note that the option -Dfile.encoding=UTF-8 is mandatory.
sonar.web.javaOpts=-Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError
# Same as previous property, but allows to not repeat all other settings
# like -Djava.awt.headless=true
#sonar.web.javaAdditionalOpts=
# Binding IP address. For servers with more than one IP address, this property specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with the server.
#sonar.web.host=0.0.0.0
# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
#sonar.web.context=
# TCP port for incoming HTTP connections. Disabled when value is -1.
#sonar.web.port=9000
# TCP port for incoming HTTPS connections. Disabled when value is -1 (default).
#sonar.web.https.port=-1
# HTTPS - the alias used to for the server certificate in the keystore.
# If not specified the first key read in the keystore is used.
#sonar.web.https.keyAlias=
# HTTPS - the password used to access the server certificate from the
# specified keystore file. The default value is "changeit".
#sonar.web.https.keyPass=changeit
# HTTPS - the pathname of the keystore file where is stored the server certificate.
# By default, the pathname is the file ".keystore" in the user home.
# If keystoreType doesn't need a file use empty value.
#sonar.web.https.keystoreFile=
# HTTPS - the password used to access the specified keystore file. The default
# value is the value of sonar.web.https.keyPass.
#sonar.web.https.keystorePass=
# HTTPS - the type of keystore file to be used for the server certificate.
# The default value is JKS (Java KeyStore).
#sonar.web.https.keystoreType=JKS
# HTTPS - the name of the keystore provider to be used for the server certificate.
# If not specified, the list of registered providers is traversed in preference order
# and the first provider that supports the keystore type is used (see sonar.web.https.keystoreType).
#sonar.web.https.keystoreProvider=
# HTTPS - the pathname of the truststore file which contains trusted certificate authorities.
# By default, this would be the cacerts file in your JRE.
# If truststoreFile doesn't need a file use empty value.
#sonar.web.https.truststoreFile=
# HTTPS - the password used to access the specified truststore file.
#sonar.web.https.truststorePass=
# HTTPS - the type of truststore file to be used.
# The default value is JKS (Java KeyStore).
#sonar.web.https.truststoreType=JKS
# HTTPS - the name of the truststore provider to be used for the server certificate.
# If not specified, the list of registered providers is traversed in preference order
# and the first provider that supports the truststore type is used (see sonar.web.https.truststoreType).
#sonar.web.https.truststoreProvider=
# HTTPS - whether to enable client certificate authentication.
# The default is false (client certificates disabled).
# Other possible values are 'want' (certificates will be requested, but not required),
# and 'true' (certificates are required).
#sonar.web.https.clientAuth=false
# The maximum number of connections that the server will accept and process at any given time.
# When this number has been reached, the server will not accept any more connections until
# the number of connections falls below this value. The operating system may still accept connections
# based on the sonar.web.connections.acceptCount property. The default value is 50 for each
# enabled connector.
#sonar.web.http.maxThreads=50
#sonar.web.https.maxThreads=50
# The minimum number of threads always kept running. The default value is 5 for each
# enabled connector.
#sonar.web.http.minThreads=5
#sonar.web.https.minThreads=5
# The maximum queue length for incoming connection requests when all possible request processing
# threads are in use. Any requests received when the queue is full will be refused.
# The default value is 25 for each enabled connector.
#sonar.web.http.acceptCount=25
#sonar.web.https.acceptCount=25
# Access logs are generated in the file logs/access.log. This file is rolled over when it's 5Mb.
# An archive of 3 files is kept in the same directory.
# Access logs are enabled by default.
#sonar.web.accessLogs.enable=true
# TCP port for incoming AJP connections. Disabled if value is -1. Disabled by default.
#sonar.ajp.port=-1
# OTHER CONFIGURATIONS ABOUT INTERNAL FEATURES... (LDAP, SEARCH, ETC...)
# We can comment everything after this line...
多年后,有人对我的问题投了赞成票。
所以,我来这里是为了阅读这个问题,并且由于我仍在处理这个问题,所以我在 2015 年重新安装了我的整个系统。所有的事情都运行良好。当时我没有意识到问题只是Postgres配置中缺少端口。
现在,再次阅读问题并查看我的服务器配置,我发现替换此行应该可以解决问题:
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
至
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonarqube
我正在尝试将 Sonarqube 连接到 PostgreSQL,但它在启动时抛出以下错误。
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2015.05.06 17:47:45 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[search]: /usr/lib/jvm/java-7-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=/ssd/sonar/sonarqube-5.1/temp -cp ./lib/common/*:./lib/search*/ org.sonar.search.SearchServer /tmp/sq-process1977113005492303949properties
2015.05.06 17:47:45 INFO es[o.s.p.ProcessEntryPoint] Starting search
2015.05.06 17:47:45 INFO es[o.s.s.SearchServer] Starting Elasticsearch[sonarqube] on port 9001
2015.05.06 17:47:46 INFO es[o.elasticsearch.node] [sonar-1430945265510] version[1.4.4], pid[13920], build[c88f77f/2015-02-19T13:05:36Z]
2015.05.06 17:47:46 INFO es[o.elasticsearch.node] [sonar-1430945265510] initializing ...
2015.05.06 17:47:46 INFO es[o.e.plugins] [sonar-1430945265510] loaded [], sites []
2015.05.06 17:47:47 INFO es[o.elasticsearch.node] [sonar-1430945265510] initialized
2015.05.06 17:47:47 INFO es[o.elasticsearch.node] [sonar-1430945265510] starting ...
2015.05.06 17:47:47 INFO es[o.e.transport] [sonar-1430945265510] bound_address {inet[/0.0.0.0:9001]}, publish_address {inet[/192.168.0.30:9001]}
2015.05.06 17:47:47 INFO es[o.e.discovery] [sonar-1430945265510] sonarqube/jY5aYsfmTVW5G1BE521uBg
2015.05.06 17:47:50 INFO es[o.e.cluster.service] [sonar-1430945265510] new_master [sonar-1430945265510][jY5aYsfmTVW5G1BE521uBg][OobjTestServer][inet[/192.168.0.30:9001]]{rack_id=sonar-1430945265510}, reason: zen-disco-join (elected_as_master)
2015.05.06 17:47:50 INFO es[o.elasticsearch.node] [sonar-1430945265510] started
2015.05.06 17:47:50 INFO es[o.e.gateway] [sonar-1430945265510] recovered [0] indices into cluster_state
2015.05.06 17:47:50 INFO app[o.s.p.m.Monitor] Process[search] is up
2015.05.06 17:47:50 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /usr/lib/jvm/java-7-oracle/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/ssd/sonar/sonarqube-5.1/temp -cp ./lib/common/*:./lib/server*/:/ssd/sonar/sonarqube-5.1/lib/jdbc/postgresql/postgresql-9.3-1102-jdbc41.jar org.sonar.server.app.WebServer /tmp/sq-process3509085435217188319properties
2015.05.06 17:47:50 INFO web[o.s.p.ProcessEntryPoint] Starting web
2015.05.06 17:47:51 INFO web[o.s.s.app.Webapp] Webapp directory: /ssd/sonar/sonarqube-5.1/web
2015.05.06 17:47:51 INFO web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:51 INFO web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2015.05.06 17:47:51 INFO web[o.e.plugins] [sonar-1430945265510] loaded [], sites []
2015.05.06 17:47:52 INFO web[o.s.s.p.ServerImpl] SonarQube Server / 5.1 / 4aa9af3a6a4362b61db365fba32eb0a55d411e7a
2015.05.06 17:47:52 INFO web[o.s.c.p.Database] Create JDBC datasource for jdbc:postgresql://localhost/sonarqube
2015.05.06 17:47:52 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:117) ~[sonar-core-5.1.jar:na]
at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:73) ~[sonar-core-5.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_76]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1015) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1008) ~[picocontainer-2.14.3.jar:na]
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766) ~[picocontainer-2.14.3.jar:na]
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91) ~[sonar-plugin-api-5.1.jar:na]
at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:96) ~[sonar-server-5.1.jar:na]
at org.sonar.server.platform.Platform.init(Platform.java:72) ~[sonar-server-5.1.jar:na]
at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43) ~[sonar-server-5.1.jar:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4720) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) [tomcat-embed-core-8.0.18.jar:8.0.18]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_76]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_76]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_76]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_76]
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Conexão negada. Verifique se o nome da máquina e a porta estão corretos e se o postmaster está aceitando conexões TCP/IP.)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:115) ~[sonar-core-5.1.jar:na]
... 27 common frames omitted
Caused by: org.postgresql.util.PSQLException: Conexão negada. Verifique se o nome da máquina e a porta estão corretos e se o postmaster está aceitando conexões TCP/IP.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:215) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:144) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.Driver.makeConnection(Driver.java:410) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.Driver.connect(Driver.java:280) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ~[commons-dbcp-1.4.jar:1.4]
... 30 common frames omitted
Caused by: java.net.ConnectException: Conexão recusada
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.7.0_76]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) ~[na:1.7.0_76]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) ~[na:1.7.0_76]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) ~[na:1.7.0_76]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.7.0_76]
at java.net.Socket.connect(Socket.java:579) ~[na:1.7.0_76]
at org.postgresql.core.PGStream.<init>(PGStream.java:61) ~[postgresql-9.3-1102-jdbc41.jar:na]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:109) ~[postgresql-9.3-1102-jdbc41.jar:na]
... 42 common frames omitted
2015.05.06 17:47:52 INFO web[jruby.rack] jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.7.0_76-b13 [linux-amd64]
2015.05.06 17:47:52 INFO web[jruby.rack] using a shared (threadsafe!) runtime
2015.05.06 17:47:56 ERROR web[jruby.rack] initialization failed
org.jruby.rack.RackInitializationException: java.lang.NullPointerException
at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:31) ~[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.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4720) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.0.18.jar:8.0.18]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) [tomcat-embed-core-8.0.18.jar:8.0.18]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_76]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_76]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_76]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_76]
Caused by: java.lang.NullPointerException: null
at org.sonar.server.ui.JRubyFacade.get(JRubyFacade.java:77) ~[sonar-server-5.1.jar:na]
at org.sonar.server.ui.JRubyFacade.getDatabase(JRubyFacade.java:209) ~[sonar-server-5.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_76]
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.IfNode.interpret(IfNode.java:118) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306) ~[jruby-complete-1.7.9.jar:na]
at org.jruby.rack.DefaultRackApplicationFactory.create(DefaultRackApplicationFactory.java:98) ~[jruby-rack-1.1.13.2.jar:na]
at org.jruby.rack.DefaultRackApplicationFactory$RackApplicationImpl.init(DefaultRackApplicationFactory.java:420) ~[jruby-rack-1.1.13.2.jar:na]
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:111) ~[jruby-rack-1.1.13.2.jar:na]
at org.jruby.rack.SharedRackApplicationFactory.doInit(SharedRackApplicationFactory.java:31) ~[jruby-rack-1.1.13.2.jar:na]
at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:94) ~[jruby-rack-1.1.13.2.jar:na]
... 10 common frames omitted
2015.05.06 17:47:56 ERROR web[o.a.c.c.StandardContext] Error listenerStart
2015.05.06 17:47:56 ERROR web[o.a.c.c.StandardContext] Context [] startup failed due to previous errors
2015.05.06 17:47:56 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Timer-0] 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.util.TimerThread.mainLoop(Timer.java:552)
java.util.TimerThread.run(Timer.java:505)
2015.05.06 17:47:56 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(LockSupport.java:186)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
2015.05.06 17:47:56 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(LockSupport.java:186)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
2015.05.06 17:47:56 INFO web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:56 INFO web[o.s.s.a.TomcatAccessLog] Web server is started
2015.05.06 17:47:56 INFO web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2015.05.06 17:47:56 WARN web[o.s.p.ProcessEntryPoint] Fail to start web
java.lang.IllegalStateException: Webapp did not start
at org.sonar.server.app.EmbeddedTomcat.isReady(EmbeddedTomcat.java:84) ~[sonar-server-5.1.jar:na]
at org.sonar.server.app.WebServer.isReady(WebServer.java:45) [sonar-server-5.1.jar:na]
at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:80) ~[sonar-process-5.1.jar:na]
at org.sonar.server.app.WebServer.main(WebServer.java:66) [sonar-server-5.1.jar:na]
2015.05.06 17:47:56 INFO web[o.a.c.h.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:57 INFO web[o.a.c.h.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:57 INFO web[o.a.c.h.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.05.06 17:47:57 INFO web[o.s.s.a.TomcatAccessLog] Web server is stopped
2015.05.06 17:47:57 INFO app[o.s.p.m.TerminatorThread] Process[search] is stopping
2015.05.06 17:47:57 INFO es[o.s.p.StopWatcher] Stopping process
2015.05.06 17:47:57 INFO es[o.elasticsearch.node] [sonar-1430945265510] stopping ...
2015.05.06 17:47:57 INFO es[o.elasticsearch.node] [sonar-1430945265510] stopped
2015.05.06 17:47:57 INFO es[o.elasticsearch.node] [sonar-1430945265510] closing ...
2015.05.06 17:47:57 INFO es[o.elasticsearch.node] [sonar-1430945265510] closed
2015.05.06 17:47:58 INFO app[o.s.p.m.TerminatorThread] Process[search] is stopped
所以我检查了用户凭据(属性前缀为sonar.jdbc),一切正常。用户 sonarqube 被创建到数据库中。有人可以帮忙吗?
这是 sonar.properties 文件:
# This file must contain only ISO 8859-1 characters.
# See http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
#
# Property values can:
# - reference an environment variable, for example sonar.jdbc.url= ${env:SONAR_JDBC_URL}
# - be encrypted. See http://docs.codehaus.org/display/SONAR/Settings+Encryption
#--------------------------------------------------------------------------------------------------
# DATABASE
#
# IMPORTANT: the embedded H2 database is used by default. It is recommended for tests but not for
# production use. Supported databases are MySQL, Oracle, PostgreSQL and Microsoft SQLServer.
# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=sonarqube
sonar.jdbc.password=sonarqube
#----- Embedded Database (default)
# It does not accept connections from remote hosts, so the
# server and the analyzers must be executed on the same host.
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092
#----- MySQL 5.x
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
#----- Oracle 10g/11g
# - Only thin client is supported
# - Only versions 11.2.* of Oracle JDBC driver are supported, even if connecting to lower Oracle versions.
# - The JDBC driver must be copied into the directory extensions/jdbc-driver/oracle/
# - If you need to set the schema, please refer to http://jira.codehaus.org/browse/SONAR-5000
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE
#----- PostgreSQL 8.x/9.x
# If you don't use the schema named "public", please refer to http://jira.codehaus.org/browse/SONAR-5000
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#----- Microsoft SQLServer 2005/2008
# Only the distributed jTDS driver is supported.
#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
#----- Connection pool settings
sonar.jdbc.maxActive=20
sonar.jdbc.maxIdle=5
sonar.jdbc.minIdle=2
sonar.jdbc.maxWait=5000
sonar.jdbc.minEvictableIdleTimeMillis=600000
sonar.jdbc.timeBetweenEvictionRunsMillis=30000
#--------------------------------------------------------------------------------------------------
# WEB SERVER
# Web server is executed in a dedicated Java process. By default its heap size is 768Mb.
# Use the following property to customize JVM options. Enabling the HotSpot Server VM
# mode (-server) is recommended.
# Note that the option -Dfile.encoding=UTF-8 is mandatory.
sonar.web.javaOpts=-Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError
# Same as previous property, but allows to not repeat all other settings
# like -Djava.awt.headless=true
#sonar.web.javaAdditionalOpts=
# Binding IP address. For servers with more than one IP address, this property specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with the server.
#sonar.web.host=0.0.0.0
# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
#sonar.web.context=
# TCP port for incoming HTTP connections. Disabled when value is -1.
#sonar.web.port=9000
# TCP port for incoming HTTPS connections. Disabled when value is -1 (default).
#sonar.web.https.port=-1
# HTTPS - the alias used to for the server certificate in the keystore.
# If not specified the first key read in the keystore is used.
#sonar.web.https.keyAlias=
# HTTPS - the password used to access the server certificate from the
# specified keystore file. The default value is "changeit".
#sonar.web.https.keyPass=changeit
# HTTPS - the pathname of the keystore file where is stored the server certificate.
# By default, the pathname is the file ".keystore" in the user home.
# If keystoreType doesn't need a file use empty value.
#sonar.web.https.keystoreFile=
# HTTPS - the password used to access the specified keystore file. The default
# value is the value of sonar.web.https.keyPass.
#sonar.web.https.keystorePass=
# HTTPS - the type of keystore file to be used for the server certificate.
# The default value is JKS (Java KeyStore).
#sonar.web.https.keystoreType=JKS
# HTTPS - the name of the keystore provider to be used for the server certificate.
# If not specified, the list of registered providers is traversed in preference order
# and the first provider that supports the keystore type is used (see sonar.web.https.keystoreType).
#sonar.web.https.keystoreProvider=
# HTTPS - the pathname of the truststore file which contains trusted certificate authorities.
# By default, this would be the cacerts file in your JRE.
# If truststoreFile doesn't need a file use empty value.
#sonar.web.https.truststoreFile=
# HTTPS - the password used to access the specified truststore file.
#sonar.web.https.truststorePass=
# HTTPS - the type of truststore file to be used.
# The default value is JKS (Java KeyStore).
#sonar.web.https.truststoreType=JKS
# HTTPS - the name of the truststore provider to be used for the server certificate.
# If not specified, the list of registered providers is traversed in preference order
# and the first provider that supports the truststore type is used (see sonar.web.https.truststoreType).
#sonar.web.https.truststoreProvider=
# HTTPS - whether to enable client certificate authentication.
# The default is false (client certificates disabled).
# Other possible values are 'want' (certificates will be requested, but not required),
# and 'true' (certificates are required).
#sonar.web.https.clientAuth=false
# The maximum number of connections that the server will accept and process at any given time.
# When this number has been reached, the server will not accept any more connections until
# the number of connections falls below this value. The operating system may still accept connections
# based on the sonar.web.connections.acceptCount property. The default value is 50 for each
# enabled connector.
#sonar.web.http.maxThreads=50
#sonar.web.https.maxThreads=50
# The minimum number of threads always kept running. The default value is 5 for each
# enabled connector.
#sonar.web.http.minThreads=5
#sonar.web.https.minThreads=5
# The maximum queue length for incoming connection requests when all possible request processing
# threads are in use. Any requests received when the queue is full will be refused.
# The default value is 25 for each enabled connector.
#sonar.web.http.acceptCount=25
#sonar.web.https.acceptCount=25
# Access logs are generated in the file logs/access.log. This file is rolled over when it's 5Mb.
# An archive of 3 files is kept in the same directory.
# Access logs are enabled by default.
#sonar.web.accessLogs.enable=true
# TCP port for incoming AJP connections. Disabled if value is -1. Disabled by default.
#sonar.ajp.port=-1
# OTHER CONFIGURATIONS ABOUT INTERNAL FEATURES... (LDAP, SEARCH, ETC...)
# We can comment everything after this line...
多年后,有人对我的问题投了赞成票。
所以,我来这里是为了阅读这个问题,并且由于我仍在处理这个问题,所以我在 2015 年重新安装了我的整个系统。所有的事情都运行良好。当时我没有意识到问题只是Postgres配置中缺少端口。
现在,再次阅读问题并查看我的服务器配置,我发现替换此行应该可以解决问题:
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
至
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonarqube