Search code examples
mysqlgerrit

Gerrit fails to start the service


Environment:

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

Gerrit service was running fine. Today restarted the server and tried to start the gerrit service, But it failed to start.

$ ./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

Last few lines of service start command.

+ 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

Further executed

$ 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$1.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$1.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 service running fine, With Gerrit DB user able to login to DB on terminal.

Further how do i troubleshoot? I do not have any clue to find this problem.


Solution

  • Found that MYSQL upgraded to 5.7.36 from 5.7.32 version and due to this gerrit service was not starting and failing with above errors.

    Solved by replacing existing mysql-connector-java-5.1.43.jar with recent mysql-connector-java-5.1.49.jar in gerrit.