SonarQube与MySql设置错误

时间:2015-09-17 15:38:03

标签: mysql sonarqube sonarqube5.1.2

我已经检查了this similar issue here,但在我的情况下它没有用。

我正尝试在SonarQube Server本地设置Windows OS[non English language]但是我在http://localhost:8000上收到此错误:

    org.jruby.rack.RackInitializationException: ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin' at line 1: CREATE TABLE `schema_migrations` (`version` varchar NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `create_table'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/mysql/adapter.rb:252:in `create_table'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/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 C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441:in `initialize'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in `up'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:in `migrate'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:62:in `upgrade_and_start'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:73:in `automatic_setup'
    from C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/environment.rb:272:in `(root)'
    from org/jruby/RubyKernel.java:1094:in `load'
    from file:/C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1:in `(root)'
    from file:/C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25:in `load_environment'
    from file:/C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/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(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.jruby.exceptions.RaiseException: (StatementInvalid) ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin' at line 1: CREATE TABLE `schema_migrations` (`version` varchar NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin
    at RUBY.log(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227)
    at RUBY.execute(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183)
    at RUBY.create_table(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109)
    at RUBY.create_table(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/mysql/adapter.rb:252)
    at RUBY.initialize_schema_migrations_table(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:371)
    at RUBY.initialize(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441)
    at RUBY.up(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401)
    at RUBY.migrate(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383)
    at RUBY.upgrade_and_start(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:62)
    at RUBY.automatic_setup(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:73)
    at RUBY.(root)(C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/environment.rb:272)
    at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1094)
    at RUBY.(root)(file:/C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1)
    at RUBY.load_environment(file:/C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25)
    at RUBY.load_environment(file:/C:/Users/s/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79)

尝试:

  • 选中User PriviledgesDatabase
  • 更改了default port中的Sonar来自sonar.properties[sonar.web.port=8000] 案例另一项服务正在使用它
  • 重新启动声纳服务
  • JDK path
  • 上手动写了wrapper.config(wrapper.java.command=C:\Program Files\Java\jdk1.8.0_60)

[以上都没有工作]

以下是我的配置sonar.properties

# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar

#----- 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:h2:tcp://localhost:9092/sonar

# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092


#----- MySQL 5.x
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported.
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

# - 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
#...
#--------------------------------------------------------------------------------------------------
# WEB SERVER

# Web server is executed in a dedicated Java process. By default heap size is 768Mb.
# Use the following property to customize JVM options.
#    Recommendations:
#
#    The HotSpot Server VM is recommended. The property -server should be added if server mode
#    is not enabled by default on your environment: http://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html
#
#    Set min and max memory (respectively -Xms and -Xmx) to the same value to prevent heap
#    from resizing at runtime.
#
#sonar.web.javaOpts=-Xmx768m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError

# Same as previous property, but allows to not repeat all other settings like -Xmx
#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=127.0.0.1

# 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=8000

Script用于创建Sonar DB

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;

这里是完整的sonar.log

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

2015.09.28 09:49:27 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[search]: C:\Program Files\Java\jre1.8.0_60\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=C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\temp -cp ./lib/common/*;./lib/search/* org.sonar.search.SearchServer C:\Users\SS~1\AppData\Local\Temp\sq-process5996908890443263390properties
2015.09.28 09:49:28 INFO   es[o.s.p.ProcessEntryPoint]  Starting search
2015.09.28 09:49:28 INFO   es[o.s.s.SearchServer]  Starting Elasticsearch[sonarqube] on port 9001
2015.09.28 09:49:29 INFO   es[o.elasticsearch.node]  [sonar-1443422966104] version[1.4.4], pid[8044], build[c88f77f/2015-02-19T13:05:36Z]
2015.09.28 09:49:29 INFO   es[o.elasticsearch.node]  [sonar-1443422966104] initializing ...
2015.09.28 09:49:29 INFO   es[o.e.plugins]  [sonar-1443422966104] loaded [], sites []
2015.09.28 09:49:34 INFO   es[o.elasticsearch.node]  [sonar-1443422966104] initialized
2015.09.28 09:49:34 INFO   es[o.elasticsearch.node]  [sonar-1443422966104] starting ...
2015.09.28 09:49:36 INFO   es[o.e.transport]  [sonar-1443422966104] bound_address {inet[/0.0.0.0:9001]}, publish_address {inet[/192.168.1.103:9001]}
2015.09.28 09:49:36 INFO   es[o.e.discovery]  [sonar-1443422966104] sonarqube/JRwVvtz7Qb2Nfq2TD0uGeQ
2015.09.28 09:49:39 INFO   es[o.e.cluster.service]  [sonar-1443422966104] new_master [sonar-1443422966104][JRwVvtz7Qb2Nfq2TD0uGeQ][ss-pc][inet[/192.168.1.103:9001]]{rack_id=sonar-1443422966104}, reason: zen-disco-join (elected_as_master)
2015.09.28 09:49:39 INFO   es[o.elasticsearch.node]  [sonar-1443422966104] started
2015.09.28 09:49:40 INFO   es[o.e.gateway]  [sonar-1443422966104] recovered [1] indices into cluster_state
2015.09.28 09:49:40 INFO  app[o.s.p.m.Monitor] Process[search] is up
2015.09.28 09:49:40 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: C:\Program Files\Java\jre1.8.0_60\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=C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\temp -cp ./lib/common/*;./lib/server/*;C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\lib\jdbc\mysql\mysql-connector-java-5.1.34.jar org.sonar.server.app.WebServer C:\Users\SELAHA~1\AppData\Local\Temp\sq-process3295624311748506992properties
2015.09.28 09:49:42 INFO  web[o.s.p.ProcessEntryPoint] Starting web
2015.09.28 09:49:42 INFO  web[o.s.s.app.Webapp] Webapp directory: C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\web
2015.09.28 09:49:43 INFO  web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.09.28 09:49:43 INFO  web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2015.09.28 09:49:50 INFO  web[o.e.plugins] [sonar-1443422966104] loaded [], sites []
2015.09.28 09:49:51 INFO  web[o.s.s.p.ServerImpl] SonarQube Server / 5.1.2 / 2a52a7106b2bfbd659c591c2d6fc09ad0ab2db5c
2015.09.28 09:49:51 INFO  web[o.s.c.p.Database] Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
2015.09.28 09:49:54 INFO  web[o.s.s.p.DefaultServerFileSystem] SonarQube home: C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2
2015.09.28 09:49:55 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Install plugins
2015.09.28 09:49:55 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin Core / 5.1.2 / 2a52a7106b2bfbd659c591c2d6fc09ad0ab2db5c
2015.09.28 09:49:55 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin Email notifications / 5.1.2 / 2a52a7106b2bfbd659c591c2d6fc09ad0ab2db5c
2015.09.28 09:49:55 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin Java / 3.0 / 65396a609ddface8b311a6a665aca92a7da694f1
2015.09.28 09:49:55 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin Git / 1.0 / 9ce9d330c313c296fab051317cc5ad4b26319e07
2015.09.28 09:49:55 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin English Pack / 5.1.2 / 2a52a7106b2bfbd659c591c2d6fc09ad0ab2db5c
2015.09.28 09:49:55 INFO  web[o.s.s.p.ServerPluginJarsInstaller] Deploy plugin SVN / 1.0 / 213fc8a8b582ff530b12dd4a59a6512be1071234
2015.09.28 09:49:55 INFO  web[o.s.s.p.RailsAppsDeployer] Deploy Ruby on Rails applications
2015.09.28 09:49:55 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.8.0_60-b27 [Windows 7-amd64]
2015.09.28 09:49:55 INFO  web[jruby.rack] using a shared (threadsafe!) runtime
2015.09.28 09:50:14 INFO  web[jruby.rack] An exception happened during JRuby-Rack startup
ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin' at line 1: CREATE TABLE `schema_migrations` (`version` varchar NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin
--- System
jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27 [Windows 7-amd64]
Time: Mon Sep 28 09:50:14 +0300 2015
Server: Apache Tomcat/8.0.18
jruby.home: file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/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 = C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\temp
process.terminationTimeout = 60000
public.root = /
rails.env = production
sonar.cluster.name = sonarqube
sonar.jdbc.driverPath = C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\lib\jdbc\mysql\mysql-connector-java-5.1.34.jar
sonar.jdbc.maxActive = 50
sonar.jdbc.maxIdle = 5
sonar.jdbc.maxWait = 5000
sonar.jdbc.minEvictableIdleTimeMillis = 600000
sonar.jdbc.minIdle = 2
sonar.jdbc.password = sonar
sonar.jdbc.timeBetweenEvictionRunsMillis = 30000
sonar.jdbc.url = jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.jdbc.username = sonar
sonar.node.name = sonar-1443422966104
sonar.path.data = C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\data
sonar.path.home = C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2
sonar.path.logs = C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\logs
sonar.path.temp = C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\temp
sonar.path.web = C:\Users\ss\Desktop\SonarQube\sonarqube-5.1.2\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: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin' at line 1: CREATE TABLE `schema_migrations` (`version` varchar NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin
                                 log at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227
                             execute at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183
                        create_table at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109
                        create_table at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/mysql/adapter.rb:252
  initialize_schema_migrations_table at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:371
                          initialize at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441
                                  up at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401
                             migrate at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383
                   upgrade_and_start at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:62
                     automatic_setup at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:73
                              (root) at C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/environment.rb:272
                                load at org/jruby/RubyKernel.java:1094
                              (root) at file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1
                    load_environment at file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25
                    load_environment at file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79

--- RubyGems
Gem.dir: C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems
Gem.path:
C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/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@5a8f2e80
equals = <error: >
err = java.io.PrintStream@7e976a6c
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@55699f6e
logger_class_name = slf4j
logger_name = jruby.rack
maximum_memory_buffer_size = 
maximum_runtimes = 1
num_initializer_threads = 
out = java.io.PrintStream@4365d1bf
rackup = 
rackup_path = 
rewindable = true
runtime_arguments = 
runtime_environment = 
runtime_timeout_seconds = 
serial_initialization = false
servlet_context = org.apache.catalina.core.ApplicationContextFacade@7a015703
throw_init_exception = false

2015.09.28 09:50:14 ERROR web[jruby.rack] initialization failed
org.jruby.rack.RackInitializationException: ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin' at line 1: CREATE TABLE `schema_migrations` (`version` varchar NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `create_table'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/mysql/adapter.rb:252:in `create_table'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/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 C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441:in `initialize'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in `up'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:in `migrate'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:62:in `upgrade_and_start'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:73:in `automatic_setup'
    from C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/environment.rb:272:in `(root)'
    from org/jruby/RubyKernel.java:1094:in `load'
    from file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1:in `(root)'
    from file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25:in `load_environment'
    from file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/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(Unknown Source) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_60]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_60]
Caused by: org.jruby.exceptions.RaiseException: (StatementInvalid) ActiveRecord::JDBCError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin' at line 1: CREATE TABLE `schema_migrations` (`version` varchar NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin
    at RUBY.log(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227) ~[na:na]
    at RUBY.execute(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183) ~[na:na]
    at RUBY.create_table(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:109) ~[na:na]
    at RUBY.create_table(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/mysql/adapter.rb:252) ~[na:na]
    at RUBY.initialize_schema_migrations_table(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:371) ~[na:na]
    at RUBY.initialize(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:441) ~[na:na]
    at RUBY.up(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401) ~[na:na]
    at RUBY.migrate(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383) ~[na:na]
    at RUBY.upgrade_and_start(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:62) ~[na:na]
    at RUBY.automatic_setup(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/web/WEB-INF/config/../lib/database_version.rb:73) ~[na:na]
    at RUBY.(root)(C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/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:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1) ~[na:na]
    at RUBY.load_environment(file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25) ~[na:na]
    at RUBY.load_environment(file:/C:/Users/ss/Desktop/SonarQube/sonarqube-5.1.2/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79) ~[na:na]
2015.09.28 09:50:15 INFO  web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]
2015.09.28 09:50:15 INFO  web[o.s.s.a.TomcatAccessLog] Web server is started
2015.09.28 09:50:15 INFO  web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2015.09.28 09:50:15 INFO  app[o.s.p.m.Monitor] Process[web] is up

我缺少什么? [从MySql Error似乎缺少varchar的长度

1 个答案:

答案 0 :(得分:0)

问题出在schema_migration查询VARCHAR没有长度。我使用以下查询手动创建了该表:

CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin

它解决了这个问题。

注意: [问题消失后,它会在服务器启动时自动创建其他所需的表,但这次您将面临升级/迁移消息。这意味着当您尝试访问服务器时(例如:localhost),它会将您重定向到维护页面(localhost/maintenance)。更改为移至设置页面(localhost/setup)并继续升级]