Re: Gerrit setup fail with mysql

2,833 views
Skip to first unread message

Matthias Sohn

unread,
Mar 12, 2013, 2:44:31 AM3/12/13
to Lams, Repo and Gerrit Discussion
On Tue, Mar 12, 2013 at 4:31 AM, Lams <lams...@gmail.com> wrote:
Hi all,

I follow the instruction on http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/install.html to setup Gerrit 2.5.2 with mysql. But when I try to init the site, I always got follow error:

====================================================
fatal: DbInjector failed
fatal: Unable to determine SqlDialect
fatal:   caused by com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
fatal:
fatal: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
fatal:   caused by com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
fatal:
fatal: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
fatal:   caused by java.net.ConnectException: Connection timed out
====================================================

* I check the mysql server, the user 'gerrit2'@'localhost' has the full rights for the reviewdb database.
* In mysql.cnf,  'bind-address  = 127.0.0.1'

But why Gerrit keep complain it cannot connect to the database? Anything I miss?

did you configure the [database] section in gerrit.config and secure.config ?

--
Matthias 

Mohan .S

unread,
Mar 29, 2015, 1:15:49 PM3/29/15
to repo-d...@googlegroups.com, lams...@gmail.com

Dear Team,

 

Even I too facing the same problem

 

Error message is,

 

fatal: DbInjector failed

fatal: Unable to determine SqlDialect

fatal:   caused by com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

fatal:

fatal: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

      fatal:   caused by java.net.ConnectException: Connection refused

 

Kindly let me know the workaround for the same.

 

-Mohan

Alex Blewitt

unread,
Mar 29, 2015, 1:30:01 PM3/29/15
to Mohan .S, repo-d...@googlegroups.com, lams...@gmail.com
Please list the debugging steps and analysis you have done to understand the problem further. 

Alex

Sent from my iPhat 6
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mohan .S

unread,
Mar 31, 2015, 12:21:36 AM3/31/15
to repo-d...@googlegroups.com, moha...@gmail.com, lams...@gmail.com
Hi Alex,

Could you please tell how to list the debugging steps?

Below are the steps which I tried and got the error.

root@mohan-ubuntu:/gitstg# java -jar gerrit-2.10.war init -d reviewdb/
*** Gerrit Code Review 2.10
***

*** Git Repositories
***
Location of Git repositories   [/gitstg]:
*** SQL Database
***
Database server type           [mysql]:
Server hostname                [mohan-ubuntu]: mohan-ubuntu
Server port                    [(mysql default)]:
Database name                  [reviewdb]:
Database username              [root]: root
Change root's password         [y/N]? N
*** Index
***
Type                           [LUCENE/?]:
The index must be rebuilt before starting Gerrit:
  java -jar gerrit.war reindex -d site_path
*** User Authentication
***
Authentication method          [OPENID/?]:
*** Review Labels
***
Install Verified label         [y/N]?
*** Email Delivery
***
SMTP server hostname           [localhost]:
SMTP server port               [(default)]:
SMTP encryption                [NONE/?]:
SMTP username                  :
*** Container Process
***
Run as                         [root]:
Java runtime                   [/usr/lib/jvm/java-7-openjdk-amd64/jre]:
Upgrade /gitstg/reviewdb/bin/gerrit.war [Y/n]?
Copying gerrit-2.10.war to /gitstg/reviewdb/bin/gerrit.war
*** SSH Daemon
***
Listen on address              [*]:
Listen on port                 [29418]:
*** HTTP Daemon
***
Behind reverse proxy           [y/N]?
Use SSL (https://)             [y/N]?
Listen on address              [*]:
Listen on port                 [8081]:
Canonical URL                  [http://mohan-ubuntu:8081/]:
*** Plugins
***
Install plugin commit-message-length-validator version v2.10 [y/N]?
Install plugin download-commands version v2.10 [y/N]?
Install plugin replication version v2.10 [y/N]?
Install plugin reviewnotes version v2.10 [y/N]?
Install plugin singleusergroup version v2.10 [y/N]?
fatal: DbInjector failed
fatal: Unable to determine SqlDialect
fatal:   caused by com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
fatal:
fatal: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
fatal:   caused by java.net.ConnectException: Connection refused


Alex Blewitt

unread,
Mar 31, 2015, 2:59:40 AM3/31/15
to Mohan .S, repo-d...@googlegroups.com, lams...@gmail.com


> On 31 Mar 2015, at 05:21, Mohan .S <moha...@gmail.com> wrote:
>
> Could you please tell how to list the debugging steps?

I mean: what have you done to understand what the problem is? Have you tried to connect to the database you are specifying in the configuration?

Alex

Matthias Sohn

unread,
Mar 31, 2015, 3:06:03 AM3/31/15
to Mohan .S, Repo and Gerrit Discussion, Lams Yi
On Tue, Mar 31, 2015 at 6:21 AM, Mohan .S <moha...@gmail.com> wrote:
Hi Alex,

Could you please tell how to list the debugging steps?

Below are the steps which I tried and got the error.

root@mohan-ubuntu:/gitstg# java -jar gerrit-2.10.war init -d reviewdb/
*** Gerrit Code Review 2.10
***

it seems you are following setup instructions for Gerrit 2.5.2 to install Gerrit 2.10.
Follow the documentation matching the Gerrit version you want to install, the
documentation for 2.10 is here
 
*** Git Repositories
***
Location of Git repositories   [/gitstg]:
*** SQL Database
***
Database server type           [mysql]:
Server hostname                [mohan-ubuntu]: mohan-ubuntu
Server port                    [(mysql default)]:
Database name                  [reviewdb]:
Database username              [root]: root

don't run Gerrit / the database as root

Mohan .S

unread,
Mar 31, 2015, 11:37:28 PM3/31/15
to repo-d...@googlegroups.com, moha...@gmail.com, lams...@gmail.com

Dear Sohn,

Thanks for the 2.10 guideline, But still I am facing the same problem,

This time I have tried Database as with different id(mohan.s08)


My Environment details as follows,


 


Operating System: Ubuntu 12.04.3 LTS – Server (64-Bit)


 


Kernel Version:  Linux GITSERVER 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


 


Git Version: git version 1.7.9.5


 


Java Version: java version "1.7.0_75"


OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~precise1)


OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)


 


Mysql Version: mysql  Ver 14.14 Distrib 5.5.41, for debian-linux-gnu (x86_64) using readline 6.2


 


My Gerrit configuration and error as follows,


 


root@GITSERVER:/# java -jar gerrit.war init -d /home/mohan.s08/gerrit-2.10/


 


*** Gerrit Code Review 2.10


***


 


 


*** Git Repositories


***


 


Location of Git repositories   [/gitstg]:


 


*** SQL Database


***


 


Database server type           [mysql]:


Server hostname                [GITSERVER]:


Server port                    [(mysql default)]:


Database name                  [reviewdb]:


Database username              [mohan.s08]:


Change mohan.s08's password    [y/N]? N


 


*** Index


***


 


Type                           [LUCENE/?]:


 


The index must be rebuilt before starting Gerrit:


  java -jar gerrit.war reindex -d site_path


 


*** User Authentication


***


 


Authentication method          [OPENID/?]:


 


*** Review Labels


***


 


Install Verified label         [y/N]?


 


*** Email Delivery


***


 


SMTP server hostname           [localhost]:


SMTP server port               [(default)]:


SMTP encryption                [NONE/?]:


SMTP username                  :


 


*** Container Process


***


 


Run as                         [mohan.s08]:


Java runtime                   [/usr/lib/jvm/java-7-openjdk-amd64/jre]:


Upgrade /home/mohan.s08/gerrit-2.10/bin/gerrit.war [Y/n]? Y


Copying gerrit.war to /home/mohan.s08/gerrit-2.10/bin/gerrit.war


 


*** SSH Daemon


***


 


Listen on address              [*]:


Listen on port                 [29418]:


 


*** HTTP Daemon


***


 


Behind reverse proxy           [y/N]?


Use SSL (https://)             [y/N]?


Listen on address              [*]:


Listen on port                 [8081]:


Canonical URL                  [http://GITSERVER:8081/]:


 


*** Plugins


***


 


Install plugin commit-message-length-validator version v2.10 [y/N]? y


version v2.10 is already installed, overwrite it [y/N]? y


Install plugin download-commands version v2.10 [y/N]? y


version v2.10 is already installed, overwrite it [y/N]? y


Install plugin replication version v2.10 [y/N]? y


version v2.10 is already installed, overwrite it [y/N]? y

Install plugin reviewnotes version v2.10 [y/N]? y

version v2.10 is already installed, overwrite it [y/N]? y

Install plugin singleusergroup version v2.10 [y/N]? y
version v2.10 is already installed, overwrite it [y/N]? y


 fatal: DbInjector failed

fatal: Unable to determine SqlDialect

fatal:   caused by com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

fatal:

fatal: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

fatal:   caused by java.net.ConnectException: Connection refused

root@GITSERVER:/#

 Does my Ubuntu Server version required Ubuntu client pacakges?

 Kindly help me to resolve this.

Thanks,

Mohan



On Tuesday, March 31, 2015 at 12:36:03 PM UTC+5:30, Matthias Sohn wrote:


On Tue, Mar 31, 2015 at 6:21 AM, Mohan .S <moha...@gmail.com> wrote:
Hi Alex,

Could you please tell how to list the debugging steps?

Below are the steps which I tried and got the error.

ro...@mohan-ubuntu:/gitstg# java -jar gerrit-2.10.war init -d reviewdb/

Mohan .S

unread,
Apr 1, 2015, 1:43:14 AM4/1/15
to repo-d...@googlegroups.com, moha...@gmail.com, lams...@gmail.com

Team,

 

Above error resolved after updating the /etc/mysql/conf.d/

 

File from

 

#bind-address           = 127.0.0.1

bind-address           =  0.0.0.0

 

Now I am getting below error,

 

fatal: DbInjector failed

fatal: Unable to determine SqlDialect

fatal:   caused by java.sql.SQLException: Access denied for user 'mohan.s08'@'gitserver' (using password: YES)

 

I have created Mysql user name & database from below commands,

 

mysql -u root -p

CREATE USER 'mohan.s08'@'localhost' IDENTIFIED BY 'mohan@321';

CREATE DATABASE reviewdb;

GRANT ALL ON reviewdb.* TO 'mohan.s08'@'localhost';

FLUSH PRIVILEGES;

 

Then I have switched to  (mohan.s08) account and running below command, But getting above given error

mohan.s08@gitserver:/ Su mohan.s08

mohan.s08@gitserver:/ java -jar gerrit.war init -d /home/mohan.s08/gerrit-2.10/

 

Thanks,

Mohan

...

Magnus Bäck

unread,
Apr 1, 2015, 2:00:29 AM4/1/15
to Mohan .S, repo-d...@googlegroups.com, lams...@gmail.com
On Wednesday, April 01, 2015 at 07:43 CEST,
"Mohan .S" <moha...@gmail.com> wrote:

> Above error resolved after updating the /etc/mysql/conf.d/
> File from
>
> #bind-address = 127.0.0.1
> bind-address = 0.0.0.0

Indeed, "connection refused" means that no process is listening on a
particular host:port combo. This typically indicates that a daemonisn't
running, that's it's running but only listens on another interface, or
that there's a firewall blocking the connection.

> Now I am getting below error,
>
> fatal: DbInjector failed
> fatal: Unable to determine SqlDialect
> fatal: caused by java.sql.SQLException: Access denied for user
> 'mohan.s08'@'gitserver' (using password: YES)
>
> I have created Mysql user name & database from below commands,
>
> mysql -u root -p
> CREATE USER 'mohan.s08'@'localhost' IDENTIFIED BY 'mohan@321';
> CREATE DATABASE reviewdb;
> GRANT ALL ON reviewdb.* TO 'mohan.s08'@'localhost';
> FLUSH PRIVILEGES;

This appears to be the exact same type of problem. You're creating a
user that's only valid for localhost connections, yet you're connecting
over a non-loopback interface. You should probably create the user with

CREATE USER 'mohan.s08'@'%' IDENTIFIED BY 'mohan@321';

instead.

[...]

--
Magnus Bäck | Software Engineer, Development Tools
magnu...@sonymobile.com | Sony Mobile Communications

Mohan .S

unread,
Apr 1, 2015, 2:15:16 AM4/1/15
to repo-d...@googlegroups.com, moha...@gmail.com, lams...@gmail.com


Hi Magnus Bäck,

Thanks for the reply,

I have created database user name with below command,

CREATE USER 'mohan.s08'@'%' IDENTIFIED BY 'mohan@321';

But it shows below error,

fatal: DbInjector failed
fatal: Unable to determine SqlDialect

fatal:   caused by com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'mohan.s08'@'%' to database 'reviewdb'
mohan.s08@gitserver:/$

Thanks,
Mohan

Mohan .S

unread,
Apr 1, 2015, 2:45:30 AM4/1/15
to repo-d...@googlegroups.com, moha...@gmail.com, lams...@gmail.com

Thanks all,

 

I have updated the database permission like below command & changed the database password without special character and it got worked.

 

GRANT ALL ON reviewdb.* TO 'mohan.s08'@'%';

 

Thanks,

Mohan

Mohan .S

unread,
Apr 1, 2015, 3:09:25 AM4/1/15
to repo-d...@googlegroups.com, moha...@gmail.com, lams...@gmail.com
Hi Team,

Now I am getting following error,

Gerrit Code Review Error - 500 Internal Server Error

So any idea how to solve this?

Thanks,
Mohan

Magnus Bäck

unread,
Apr 1, 2015, 3:13:37 AM4/1/15
to Mohan .S, repo-d...@googlegroups.com, lams...@gmail.com
On Wednesday, April 01, 2015 at 09:09 CEST,
"Mohan .S" <moha...@gmail.com> wrote:

> Now I am getting following error,
> Gerrit Code Review Error - 500 Internal Server Error
> So any idea how to solve this?

Start by checking the Gerrit log for clues.

Mohan .S

unread,
Apr 1, 2015, 3:19:51 AM4/1/15
to repo-d...@googlegroups.com, moha...@gmail.com, lams...@gmail.com
Hi,

gerrit-2.10/logs/error.log

message is

[2015-04-01 19:53:56,739] INFO  com.google.gerrit.server.cache.h2.H2CacheFactory : Enabling disk cache /home/mohan.s
08/gerrit-2.10/cache
[2015-04-01 19:53:58,017] INFO  com.google.gerrit.server.config.ScheduleConfig : gc schedule parameter "gc.interval"
 is not configured
[2015-04-01 19:53:59,389] WARN  com.google.gerrit.sshd.SshDaemon : Disabling cipher arcfour256: invalid parameter pa
ssed to RC4 init - org.bouncycastle.crypto.params.ParametersWithIV
[2015-04-01 19:53:59,390] WARN  com.google.gerrit.sshd.SshDaemon : Disabling cipher arcfour128: invalid parameter pa
ssed to RC4 init - org.bouncycastle.crypto.params.ParametersWithIV
[2015-04-01 19:53:59,426] WARN  com.google.gerrit.httpd.GitWebConfig : gitweb not installed (no /usr/lib/cgi-bin/git
web.cgi found)
[2015-04-01 19:54:00,116] INFO  org.eclipse.jetty.util.log : Logging initialized @7661ms
[2015-04-01 19:54:00,503] INFO  com.google.gerrit.server.git.LocalDiskRepositoryManager : Defaulting core.streamFile
Threshold to 892m

Thanks,
Mohan

Mohan .S

unread,
Apr 2, 2015, 1:23:31 AM4/2/15
to repo-d...@googlegroups.com, moha...@gmail.com, lams...@gmail.com

Hi Team,

Now I am unable to start gerrit service, getting below error. I have installed and configured apache2

I have done the following changes to configure apache2


  1. vi /home/username/reviewdb/etc/ gerrit.config à updated OPENID to HTTP

  2. vi /etc/apache2/ ports.conf à updated NameVirtualHost *:8081 and Listen 8081

  3. vi /etc/apache2/sites-available/default

 

Updated below lines,

        ScriptAlias /cgi-bin/ /usr/www/cgi-bin/

       <Directory "/usr/www/cgi-bin">

 Then added below lines,

 <VirtualHost *:8081>

         ServerName 127.0.0.1

         ServerAdmin mohan.s08@localhost

         ProxyRequests Off

         ProxyVia Off

         ProxyPreserveHost On

          <Proxy *>

                 Order deny,allow

                 Allow from all

         </Proxy>

          <Location /login/>

                 AuthType Basic

                 AuthName "Gerrit Code Review"

                 Require valid-user

                 AuthUserFile /home/mohan.s08/htpasswd

         </Location>

          ProxyPass / http://127.0.0.1:8082/

         ProxyPassReverse / http://127.0.0.1:8082/

           ErrorLog /var/log/gerrit_error.log

</VirtualHost>

Now getting below error, when I tried to start gerrit service.

Error message:-

root@gitserver:~# /home/mohan.s08/gerrit-2.10/bin/gerrit.sh start

Starting Gerrit Code Review: FAILED

Kindly help me to solve the same.

Thanks,

Mohan

Reply all
Reply to author
Forward
0 new messages