SonarQube与Postgres DB

时间:2015-06-11 10:56:03

标签: postgresql sonarqube

我已经搜索并阅读了很多关于此问题的帖子,但无法找到解决我特定问题的方法。

在centos lonux盒子上运行Sonar时出现错误:

JDBCError: ERROR: no schema has been selected to create in: CREATE TABLE "schema_migrations" ("version" varchar(10485760) NOT NULL)

我已经验证了声纳用户(我正在使用sonarqube)可以访问数据库,它是自己架构的所有者,我已经授予它所有权限,只是为了确保它不是权限。

我正在使用Postgres 9.4。

完整日志就像打击一样,当试图查看声纳GUI时,它只显示一个包含以下文字的页面:

org.jruby.rack.RackInitializationException: ActiveRecord::JDBCError: ERROR: no schema has been selected to create in: CREATE TABLE "schema_migrations" ("version" varchar(10485760) NOT NULL) 
    from /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
    from /opt/sonar/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
    from /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `create_table'
    from /opt/sonar/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 /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441:in `initialize'
    from /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in `up'
    from /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:in `migrate'
    from /opt/sonar/web/WEB-INF/lib/database_version.rb:62:in `upgrade_and_start'
    from /opt/sonar/web/WEB-INF/lib/database_version.rb:73:in `automatic_setup'
    from /opt/sonar/web/WEB-INF/config/environment.rb:272:in `(root)'
    from org/jruby/RubyKernel.java:1094:in `load'
    from file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1:in `(root)'
    from file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25:in `load_environment'
    from file:/opt/sonar/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)
    at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:98)
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4720)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jruby.exceptions.RaiseException: (StatementInvalid) ActiveRecord::JDBCError: ERROR: no schema has been selected to create in: CREATE TABLE "schema_migrations" ("version" varchar(10485760) NOT NULL) 
    at RUBY.log(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227)
    at RUBY.execute(/opt/sonar/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183)
    at RUBY.create_table(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109)
    at RUBY.initialize_schema_migrations_table(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:371)
    at RUBY.initialize(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441)
    at RUBY.up(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401)
    at RUBY.migrate(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383)
    at RUBY.upgrade_and_start(/opt/sonar/web/WEB-INF/lib/database_version.rb:62)
    at RUBY.automatic_setup(/opt/sonar/web/WEB-INF/lib/database_version.rb:73)
    at RUBY.(root)(/opt/sonar/web/WEB-INF/config/environment.rb:272)
    at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1094)
    at RUBY.(root)(file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1)
    at RUBY.load_environment(file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25)
    at RUBY.load_environment(file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79)

完整日志

Starting SonarQube...
Started SonarQube.
--> 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.

2015.06.11 10:48:26 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[search]: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.45-28.b13.el6_6.x86_64/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=/opt/sonar/temp -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /tmp/sq-process5828587312976552037properties
2015.06.11 10:48:27 INFO   es[o.s.p.ProcessEntryPoint]  Starting search
2015.06.11 10:48:27 INFO   es[o.s.s.SearchServer]  Starting Elasticsearch[sonarqube] on port 9001
2015.06.11 10:48:27 INFO   es[o.elasticsearch.node]  [sonar-1434016106548] version[1.4.4], pid[9441], build[c88f77f/2015-02-19T13:05:36Z]
2015.06.11 10:48:27 INFO   es[o.elasticsearch.node]  [sonar-1434016106548] initializing ...
2015.06.11 10:48:27 INFO   es[o.e.plugins]  [sonar-1434016106548] loaded [], sites []
2015.06.11 10:48:29 INFO   es[o.elasticsearch.node]  [sonar-1434016106548] initialized
2015.06.11 10:48:29 INFO   es[o.elasticsearch.node]  [sonar-1434016106548] starting ...
2015.06.11 10:48:29 INFO   es[o.e.transport]  [sonar-1434016106548] bound_address {inet[/0.0.0.0:9001]}, publish_address {inet[/10.124.36.4:9001]}
2015.06.11 10:48:29 INFO   es[o.e.discovery]  [sonar-1434016106548] sonarqube/FEFMEfLcSuCppleivZ6mEA
2015.06.11 10:48:32 INFO   es[o.e.cluster.service]  [sonar-1434016106548] new_master [sonar-1434016106548][FEFMEfLcSuCppleivZ6mEA][sixdsbox03][inet[/10.124.36.4:9001]]{rack_id=sonar-1434016106548}, reason: zen-disco-join (elected_as_master)
2015.06.11 10:48:33 INFO   es[o.elasticsearch.node]  [sonar-1434016106548] started
2015.06.11 10:48:33 INFO   es[o.e.gateway]  [sonar-1434016106548] recovered [1] indices into cluster_state
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=160m; support was removed in 8.0
2015.06.11 10:48:34 INFO  app[o.s.p.m.Monitor] Process[search] is up
2015.06.11 10:48:34 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.45-28.b13.el6_6.x86_64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx768m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/opt/sonar/temp -cp ./lib/common/*:./lib/server/*:/opt/sonar/lib/jdbc/postgresql/postgresql-9.3-1102-jdbc41.jar org.sonar.server.app.WebServer /tmp/sq-process2367145408484339873properties
2015.06.11 10:48:34 INFO  web[o.s.p.ProcessEntryPoint] Starting web
2015.06.11 10:48:35 INFO  web[o.s.s.app.Webapp] Webapp directory: /opt/sonar/web
2015.06.11 10:48:35 INFO  web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.06.11 10:48:35 INFO  web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2015.06.11 10:48:36 INFO  web[o.e.plugins] [sonar-1434016106548] loaded [], sites []
2015.06.11 10:48:36 INFO  web[o.s.s.p.ServerImpl] SonarQube Server / 5.1.1 / 0a231d24c0f1e7ce1d200274b8e9bbe00f9f49fb
2015.06.11 10:48:36 INFO  web[o.s.c.p.Database] Create JDBC datasource for jdbc:postgresql://localhost/sonarqube
2015.06.11 10:48:37 INFO  web[o.s.s.p.DefaultServerFileSystem] SonarQube home: /opt/sonar
2015.06.11 10:48:38 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Install plugins
2015.06.11 10:48:38 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin Email notifications / 5.1.1 / 0a231d24c0f1e7ce1d200274b8e9bbe00f9f49fb
2015.06.11 10:48:38 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin Core / 5.1.1 / 0a231d24c0f1e7ce1d200274b8e9bbe00f9f49fb
2015.06.11 10:48:38 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin Java / 3.0 / 65396a609ddface8b311a6a665aca92a7da694f1
2015.06.11 10:48:38 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin Git / 1.0 / 9ce9d330c313c296fab051317cc5ad4b26319e07
2015.06.11 10:48:38 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin English Pack / 5.1.1 / 0a231d24c0f1e7ce1d200274b8e9bbe00f9f49fb
2015.06.11 10:48:38 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin SVN / 1.0 / 213fc8a8b582ff530b12dd4a59a6512be1071234
2015.06.11 10:48:38 INFO  web[o.s.s.p.RailsAppsDeployer] Deploy Ruby on Rails applications
2015.06.11 10:48:38 INFO  web[jruby.rack] jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on OpenJDK 64-Bit Server VM 1.8.0_45-b13 [linux-amd64]
2015.06.11 10:48:38 INFO  web[jruby.rack] using a shared (threadsafe!) runtime
2015.06.11 10:48:47 INFO  web[jruby.rack] An exception happened during JRuby-Rack startup
ActiveRecord::JDBCError: ERROR: no schema has been selected to create in: CREATE TABLE "schema_migrations" ("version" varchar(10485760) NOT NULL)
--- System
jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on OpenJDK 64-Bit Server VM 1.8.0_45-b13 [linux-amd64]
Time: Thu Jun 11 10:48:47 +0100 2015
Server: Apache Tomcat/8.0.18
jruby.home: file:/opt/sonar/lib/server/jruby-complete-1.7.9.jar!/META-INF/jruby.home

--- Context Init Parameters:
jruby.compat.version = 1.8
jruby.max.runtimes = 1
jruby.min.runtimes = 1
jruby.rack.logging = slf4j
process.index = 1
process.key = web
process.sharedDir = /opt/sonar/temp
process.terminationTimeout = 60000
public.root = /
rails.env = production
sonar.cluster.name = sonarqube
sonar.jdbc.driverPath = /opt/sonar/lib/jdbc/postgresql/postgresql-9.3-1102-jdbc41.jar
sonar.jdbc.maxActive = 50
sonar.jdbc.maxIdle = 5
sonar.jdbc.maxWait = 5000
sonar.jdbc.minEvictableIdleTimeMillis = 600000
sonar.jdbc.minIdle = 2
sonar.jdbc.password = sonarqube
sonar.jdbc.timeBetweenEvictionRunsMillis = 30000
sonar.jdbc.url = jdbc:postgresql://localhost/sonarqube
sonar.jdbc.username = sonarqube
sonar.node.name = sonar-1434016106548
sonar.path.data = /opt/sonar/data
sonar.path.home = /opt/sonar
sonar.path.logs = /opt/sonar/logs
sonar.path.temp = /opt/sonar/temp
sonar.path.web = /opt/sonar/web
sonar.search.javaAdditionalOpts =
sonar.search.javaOpts = -Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError
sonar.search.port = 9001
sonar.search.type = TRANSPORT
sonar.web.javaAdditionalOpts =
sonar.web.javaOpts = -Xmx768m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true

--- Backtrace
ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: ERROR: no schema has been selected to create in: CREATE TABLE "schema_migrations" ("version" varchar(10485760) NOT NULL)
                                 log at /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227
                             execute at /opt/sonar/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183
                        create_table at /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109
  initialize_schema_migrations_table at /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:371
                          initialize at /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441
                                  up at /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401
                             migrate at /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383
                   upgrade_and_start at /opt/sonar/web/WEB-INF/lib/database_version.rb:62
                     automatic_setup at /opt/sonar/web/WEB-INF/lib/database_version.rb:73
                              (root) at /opt/sonar/web/WEB-INF/config/environment.rb:272
                                load at org/jruby/RubyKernel.java:1094
                              (root) at file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1
                    load_environment at file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25
                    load_environment at file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79

--- RubyGems
Gem.dir: /opt/sonar/web/WEB-INF/gems
Gem.path:
/opt/sonar/web/WEB-INF/gems
Activated gems:
  activesupport-2.3.15
  activerecord-2.3.15
  rack-1.1.6
  actionpack-2.3.15
  rails-2.3.15
  color-tools-1.3.0
  i18n-0.4.2
  json-jruby-1.2.3-universal-java-1.6
  activerecord-jdbc-adapter-1.1.3
  fastercsv-1.4.0

--- Bundler
undefined method `bundle_path' for Bundler:Module

--- JRuby-Rack Config
compat_version = RUBY1_8
default_logger = org.jruby.rack.logging.StandardOutLogger@238dcac9
equals = <error: >
err = java.io.PrintStream@2ca0e62a
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_memory_buffer_size =
initial_runtimes = 1
jms_connection_factory =
jms_jndi_properties =
logger = org.jruby.rack.logging.Slf4jLogger@64935b57
logger_class_name = slf4j
logger_name = jruby.rack
maximum_memory_buffer_size =
maximum_runtimes = 1
num_initializer_threads =
out = java.io.PrintStream@4a8c212
rackup =
rackup_path =
rewindable = true
runtime_arguments =
runtime_environment =
runtime_timeout_seconds =
serial_initialization = false
servlet_context = org.apache.catalina.core.ApplicationContextFacade@2eaa81c7
throw_init_exception = false

2015.06.11 10:48:47 ERROR web[jruby.rack] initialization failed
org.jruby.rack.RackInitializationException: ActiveRecord::JDBCError: ERROR: no schema has been selected to create in: CREATE TABLE "schema_migrations" ("version" varchar(10485760) NOT NULL)
        from /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
        from /opt/sonar/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
        from /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `create_table'
        from /opt/sonar/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 /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441:in `initialize'
        from /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in `up'
        from /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:in `migrate'
        from /opt/sonar/web/WEB-INF/lib/database_version.rb:62:in `upgrade_and_start'
        from /opt/sonar/web/WEB-INF/lib/database_version.rb:73:in `automatic_setup'
        from /opt/sonar/web/WEB-INF/config/environment.rb:272:in `(root)'
        from org/jruby/RubyKernel.java:1094:in `load'
        from file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1:in `(root)'
        from file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25:in `load_environment'
        from file:/opt/sonar/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.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:266) [na:1.8.0_45]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: org.jruby.exceptions.RaiseException: (StatementInvalid) ActiveRecord::JDBCError: ERROR: no schema has been selected to create in: CREATE TABLE "schema_migrations" ("version" varchar(10485760) NOT NULL)
        at RUBY.log(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227) ~[na:na]
        at RUBY.execute(/opt/sonar/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183) ~[na:na]
        at RUBY.create_table(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109) ~[na:na]
        at RUBY.initialize_schema_migrations_table(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:371) ~[na:na]
        at RUBY.initialize(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441) ~[na:na]
        at RUBY.up(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401) ~[na:na]
        at RUBY.migrate(/opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383) ~[na:na]
        at RUBY.upgrade_and_start(/opt/sonar/web/WEB-INF/lib/database_version.rb:62) ~[na:na]
        at RUBY.automatic_setup(/opt/sonar/web/WEB-INF/lib/database_version.rb:73) ~[na:na]
        at RUBY.(root)(/opt/sonar/web/WEB-INF/config/environment.rb:272) ~[na:na]
        at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1094) ~[jruby-complete-1.7.9.jar:na]
        at RUBY.(root)(file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1) ~[na:na]
        at RUBY.load_environment(file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25) ~[na:na]
        at RUBY.load_environment(file:/opt/sonar/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79) ~[na:na]
2015.06.11 10:48:47 INFO  web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.06.11 10:48:47 INFO  web[o.s.s.a.TomcatAccessLog] Web server is started
2015.06.11 10:48:47 INFO  web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2015.06.11 10:48:47 INFO  app[o.s.p.m.Monitor] Process[web] is up

2 个答案:

答案 0 :(得分:2)

看起来没有正确设置数据库以使用Sonar。

sonar.jdbc.url = jdbc:postgresql:// localhost / sonarqube sonar.jdbc.username = sonarqube

由于您使用的是PostgresSQL,我会指向以下GIST:https://gist.github.com/RawToast/feab6b36d2592554d071

只需将Gist中的用户和数据库引用从'sonar'更改为'sonarqube',并在sonar.jdbc.username下为sonar.properties添加密码(例如sonar.jdbc.password = sonarqube)

答案 1 :(得分:0)

也许对此做出回应太迟了,但是我最近遇到了类似的错误,我花了一些时间来调试问题。

在我的情况下,问题是误解了需要做什么,因为您需要设置具有密码的用户(Sonarqube属性)和配置(在Postgresql DB中)

sonar.jdbc.username=<sonar_user>
sonar.jdbc.password=<sonar_user_password>

然后连接字符串必须正确

sonar.jdbc.url=jdbc:postgresql://localhost:5432/<sonar_postgres_db>

然后您需要配置模式,并且必须将其设置为search_path(我仍然不了解所有内容,因此对术语表示歉意)

@RawToast的回答确实对我有所帮助,但是我必须执行以下操作:

  • 创建架构sonardb(正是Sonarqube所期望的)
  • 设置搜索路径以指向该模式ALTER USER <sonar_user> SET search_path TO sonardb;

ALTER USER声纳将search_path设置为sonardb;