SonarQube无法插入MySql数据库

问题描述 投票:1回答:2

我已经下载了SonarQube 6.7 (LTS),我已按照this页面中的说明进行操作。但似乎存在与数据库相关的问题。我使用MySQL 5.7作为数据库,我在其中创建了一个名为sonar的模式,并将正确的数据库设置放在sonar.properties文件中。在数据库方面,我已经为SonarQube添加了用户并且还赋予了管理员权限。但每当我启动Web服务器时,它就会停止,当我检查文件web.log中的web日志时,我看到有一个例外。它似乎无法在表schema_migrations中插入一个条目,这似乎是由以下原因引起的:

Caused by: java.sql.SQLException: The table does not comply with the requirements by an external plugin.

我检查了数据库,我看到表是SonarQube成功创建的。问题出在哪里?为什么?这可能是一个主要的关键问题吗?

以下是完整的日志:

2017.12.15 17:03:35 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2017.12.15 17:03:35 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2017.12.15 17:03:36 INFO  web[][o.e.p.PluginsService] no modules loaded
2017.12.15 17:03:36 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin]
2017.12.15 17:03:36 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2017.12.15 17:03:36 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2017.12.15 17:03:36 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2017.12.15 17:03:38 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2017.12.15 17:03:38 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 6.7.0.33306 / 5d031d9d2ac3f69b4b9bc600d50563b1886c7d8b
2017.12.15 17:03:38 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:mysql://localhost:3310/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
2017.12.15 17:03:39 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: D:\Programs\sonarqube-6.7
2017.12.15 17:03:39 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2017.12.15 17:03:39 INFO  web[][o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Flex / 2.3 / 79167f762219bea1fd181ff5ef6ca4b34abd1675
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarC# / 6.5.0.3766 / 6011a1e9fb002edb044ae3092d92bcfb7d9d8a2d
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJS / 3.2.0.5506 / 86da09565f891121df248835665f5d8ed98772b6
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJava / 4.15.0.12310 / 572454b93016ec73a53fe0e07b2ffdc356d21ba9
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPHP / 2.11.0.2485 / 741861a29e5f9a26c6c99c06268facb6c4f4a882
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPython / 1.8.0.1496 / 3fe3bc4d0273a5721ea2fb368dc45b1bb82fede3
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarQube :: Plugins :: SCM :: Git / 1.3.0.869 / 4da53e3f9e55f4f2e5796625cb0c5768ed152079
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarQube :: Plugins :: SCM :: SVN / 1.6.0.860 / 2111fdbd1dddda4ad6d4ed6486fd0b18c1010d3b
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTS / 1.1.0.1079 / 042c9e65239a47d92d305f9767f730b3cc1e5ed3
2017.12.15 17:03:40 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarXML / 1.4.3.1027 / 39588245cecf538bb27be4e496ff303b0143d20b
2017.12.15 17:03:46 INFO  web[][o.s.s.p.d.m.AutoDbMigration] Automatically perform DB migration on fresh install
2017.12.15 17:03:46 INFO  web[][DbMigrations] Executing DB migrations...
2017.12.15 17:03:46 INFO  web[][DbMigrations] #1 'Create initial schema'...
2017.12.15 17:07:17 ERROR web[][DbMigrations] #1 'Create initial schema': failure | time=211172ms
2017.12.15 17:07:17 ERROR web[][DbMigrations] Executed DB migrations: failure | time=211172ms
2017.12.15 17:07:17 ERROR web[][o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Failed to insert row with value 1 in table schema_migrations
    at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.done(MigrationHistoryImpl.java:88)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:76)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:67)
    at java.util.Iterator.forEachRemaining(Unknown Source)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
    at java.util.stream.ReferencePipeline$Head.forEachOrdered(Unknown Source)
    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:52)
    at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:52)
    at org.sonar.server.platform.db.migration.AutoDbMigration.start(AutoDbMigration.java:65)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
    at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
    at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
    at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
    at org.picocontainer.behaviors.Stored.start(Stored.java:110)
    at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
    at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
    at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:134)
    at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
    at org.sonar.server.platform.Platform.start(Platform.java:211)
    at org.sonar.server.platform.Platform.startSafeModeContainer(Platform.java:203)
    at org.sonar.server.platform.Platform.doStart(Platform.java:104)
    at org.sonar.server.platform.Platform.doStart(Platform.java:95)
    at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:46)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    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: java.sql.SQLException: The table does not comply with the requirements by an external plugin.
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2490)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
    at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.done(MigrationHistoryImpl.java:83)
    ... 37 common frames omitted
mysql exception jdbc sonarqube
2个回答
1
投票

此异常来自MySQL驱动程序。你好像已经安装了一个MySQL插件,禁止创建表schema_migrations

也许你已经安装了“Group Replication”插件并像https://bugs.mysql.com/bug.php?id=83165一样点击了这个例外


0
投票

这不是解决方案,但我重新安装了具有相同配置和用户(以及权限)的MySQL服务器,现在它正在工作,原因我无法理解。

我无法确定问题是什么,我也不知道如何复制问题,因为相同的操作会产生不同的结果。

© www.soinside.com 2019 - 2024. All rights reserved.