Gerrit 启动服务失败

Gerrit fails to start the service

环境:

OS - Ubuntu 18.04.6 LTS
Openjdk - 1.8.0_292
Gerrit - 2.16.17
MYSQL - 5.7.36

Gerrit 服务 运行 很好。今天重启服务器,尝试启动gerrit服务,但是启动失败。

$ ./gerrit.sh start
Starting Gerrit Code Review: FAILED

GERRIT_SITE\logs\error_log - file doesn't have information about failure.
GERRIT_SITE\bin\gerrit.sh

Updated #!/bin/sh -x
$ ./gerrit.sh start

服务启动命令的最后几行。

+ running /opt/gerrit/logs/gerrit.pid
+ test -f /opt/gerrit/logs/gerrit.pid
+ cat /opt/gerrit/logs/gerrit.pid
+ PID=8890
+ ps ax -o pid
+ grep -w 8890
+ return 1
+ echo FAILED
FAILED
+ exit 1

进一步执行

$ java -jar /opt/gerrit/gerrit-2.16.17.war daemon -d /opt/gerrit/

Thu Dec 16 10:59:46 IST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Thu Dec 16 10:59:46 IST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Thu Dec 16 10:59:46 IST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[2021-12-16 10:59:46,648] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
com.google.gerrit.common.Die: Unable to determine SqlDialect
  caused by com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 161 milliseconds ago.  The last packet sent successfully to the server was 151 milliseconds ago.
  caused by javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
        at com.google.gerrit.pgm.util.AbstractProgram.die(AbstractProgram.java:84)
        at com.google.gerrit.pgm.util.SiteProgram.createDbInjector(SiteProgram.java:226)
        at com.google.gerrit.pgm.Daemon.start(Daemon.java:348)
        at com.google.gerrit.pgm.Daemon.run(Daemon.java:274)
        at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:225)
        at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:121)
        at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:65)
        at Main.main(Main.java:28)
Caused by: java.lang.RuntimeException: DbInjector failed
        ... 12 more
Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Cannot create ReviewDb
  while locating com.google.gerrit.server.schema.ReviewDbDatabaseProvider
  while locating com.google.gwtorm.jdbc.Database<com.google.gerrit.reviewdb.server.ReviewDb>
  at com.google.gerrit.server.schema.DatabaseModule.configure(DatabaseModule.java:37)
  while locating com.google.gwtorm.server.SchemaFactory<com.google.gerrit.reviewdb.server.ReviewDb> annotated with @com.google.gerrit.server.schema.ReviewDbFactory()
    for the 1st parameter of com.google.gerrit.server.schema.NotesMigrationSchemaFactory.<init>(NotesMigrationSchemaFactory.java:32)
  at com.google.gerrit.server.schema.NotesMigrationSchemaFactory.class(NotesMigrationSchemaFactory.java:25)
  while locating com.google.gerrit.server.schema.NotesMigrationSchemaFactory
  while locating com.google.gwtorm.server.SchemaFactory<com.google.gerrit.reviewdb.server.ReviewDb>
Caused by: com.google.gwtorm.server.OrmException: Unable to determine SqlDialect
        at com.google.gwtorm.jdbc.Database.<init>(Database.java:81)
        at com.google.gerrit.server.schema.ReviewDbDatabaseProvider.get(ReviewDbDatabaseProvider.java:38)
        at com.google.gerrit.server.schema.ReviewDbDatabaseProvider.get(ReviewDbDatabaseProvider.java:27)
        at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:85)
        at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:77)
        at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:59)
        at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:61)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope.get(SingletonScope.java:168)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
        at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
        at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope.get(SingletonScope.java:168)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
        at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:211)
        at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:182)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
        at com.google.inject.Guice.createInjector(Guice.java:87)
        at com.google.gerrit.pgm.util.SiteProgram.createDbInjector(SiteProgram.java:196)
        at com.google.gerrit.pgm.Daemon.start(Daemon.java:348)
        at com.google.gerrit.pgm.Daemon.run(Daemon.java:274)
        at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:225)
        at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:121)
        at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:65)
        at Main.main(Main.java:28)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Mysql 服务 运行 很好,Gerrit 数据库用户可以在终端上登录数据库。

我该如何解决问题?我没有找到这个问题的任何线索。

发现 MYSQL5.7.32 版本升级到 5.7.36 并且由于此 gerrit 服务未启动并因上述错误而失败。

通过在 gerrit 中用最近的 mysql-connector-java-5.1.49.jar 替换现有的 mysql-connector-java-5.1.43.jar 来解决。