How to install Gerrit2 on CentOS 7

How-to-install-Gerrit2-on-CentOS-7

How to install Gerrit2 on CentOS 7. Gerrit  is a web based code review application which uses the Git version control system. Gerrit makes code review easier by generating the code changes in a side-by-side preview, allowing inline comments that can be added by a reviewer. Gerrit allows any authorized user to submit changes to the master Git repository, which simplifies the process when an approved change has to be merged in manually by the project maintainer.

System requirements?

  • A Linux VPS hosting
  • JAVA JDK higher than 1.7
  • Database Server
  • Web Server
  • GIT
  • CentOS 7 OS

1. UPDATE SYSTEM

First thing to do, is to SSH to your server, initiate a screen session and make sure your CentOS 7 VPS is fully up-to-date by running:

## screen -U -S gerrit-screen
## yum update

install git and vim

## yum install git vim

2. INSTALL JAVA

Next, JAVA is required for Gerrit installation, and you can download the latest version of JAVA easily. At the time of writing this article the latest version of JAVA is 8u25 and can be downloaded and installed using the following commands:

for 64-bit systems:

## wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.rpm" \
-O /opt/jdk-8-linux-x64.rpm

for 32-bit systems:

## wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-i586.rpm" \
-O /opt/jdk-8-linux-i586.rpm

once the JAVA package has been downloaded, install it using yum as follows:

for 32bit systems use:

## yum install /opt/jdk-8-linux-i586.rpm

for 64bit systems use:

## yum install /opt/jdk-8-linux-x64.rpm

configure the JAVA package using alternatives as in:

## JDK_DIRS=($(ls -d /usr/java/jdk*))
## JDK_VER=${JDK_DIRS[@]:(-1)}

## alternatives --install /usr/bin/java java /usr/java/"${JDK_VER##*/}"/jre/bin/java 20000
## alternatives --install /usr/bin/jar jar /usr/java/"${JDK_VER##*/}"/bin/jar 20000
## alternatives --install /usr/bin/javac javac /usr/java/"${JDK_VER##*/}"/bin/javac 20000
## alternatives --install /usr/bin/javaws javaws /usr/java/"${JDK_VER##*/}"/jre/bin/javaws 20000
## alternatives --set java /usr/java/"${JDK_VER##*/}"/jre/bin/java
## alternatives --set javaws /usr/java/"${JDK_VER##*/}"/jre/bin/javaws
## alternatives --set javac /usr/java/"${JDK_VER##*/}"/bin/javac
## alternatives --set jar /usr/java/"${JDK_VER##*/}"/bin/jar

check the JAVA version running on your system:

## java -version

3. INSTALL MARIADB (MYSQL)

Install MariaDB, the default databases server in CentOS 7 which is a drop-in-replacement for MySQL using yum:

## yum install mariadb mariadb-server mysql

Once installed, edit its server configuration file in /etc/my.cnf.d/server.cnf and add the following:

## vim /etc/my.cnf.d/server.cnf

[mysqld]
#log-bin=mysql-bin
#binlog_format=mixed
bind-address = 127.0.0.1

Start and add MariaDB to your system’s startup using systemctl:

## systemctl restart mariadb
## systemctl status mariadb
## systemctl enable mariadb

Optionally but recommended, run mysql_secure_installation to finialize MariaDB setup:

## mysql_secure_installation

Enter current password for root (enter for none): ENTER
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

4. INSTALL GERRIT

Create a database

You have to create a user and database and grant privileges on the database to the newly created user. You can achieve this using the following commands:

## mysql -u root -p

MariaDB> create database gerritdb;
MariaDB> grant all on gerritdb.* to gerrit@localhost identified by 'secret';

Initialize the Site

Gerrit stores configuration files, the server’s SSH keys and the managed Git repositories under a local directory. It’s recommended to run Gerrit Code Review as a separate user account on the system, so let’s first create a new user and login with the newly created user:

## useradd -m gerrit2
## su - gerrit2

Download gerrit

You can download gerrit using the command below:

## wget https://gerrit-releases.storage.googleapis.com/gerrit-2.9.1.war -O /home/gerrit2/gerrit.war

once the gerrit2 war file has been downloaded and you’re logged in as gerrit2, run the following command to initialize a new site directory:

## java -jar gerrit.war init -d /home/gerrit2/review_site

fill the questions asked by the wizard, for example:

Location of Git repositories   [git]: 
Database server type           [mysql]: 
Server hostname                [localhost]: 
Server port                    [(mysql default)]: 
Database name                  [gerritdb]: 
Database username              [gerrit]: 
Change gerrit's password       [y/N]? n 
Type                           [LUCENE/?]: 
Authentication method          [HTTP/?]: 
Get username from custom HTTP header [y/N]?  
SSO logout URL                 : 
Install Verified label         [y/N]? 
SMTP server hostname           [localhost]: 
SMTP server port               [(default)]: 
SMTP encryption                [NONE/?]: 
SMTP username                  : 
Run as                         [gerrit2]: 
Java runtime                   [/usr/java/jdk1.8.0_25/jre]: 
Upgrade /home/gerrit2/review_site/bin/gerrit.war [Y/n]? 
Copying gerrit.war to /home/gerrit2/review_site/bin/gerrit.war
Listen on address              [*]: 
Listen on port                 [29418]: 
Behind reverse proxy           [Y/n]? 
Proxy uses SSL (https://)      [y/N]? 
Subdirectory on proxy server   [/gerrit/]: 
Listen on address              [*]: 
Listen on port                 [8081]: 
Canonical URL                  [http://vs377.rosehosting.com/gerrit/]: 
Install plugin commit-message-length-validator version v2.9.1 [y/N]? 
Install plugin download-commands version v2.9.1 [y/N]? 
Install plugin replication version v2.9.1 [y/N]? 
Install plugin reviewnotes version v2.9.1 [y/N]? 
Install plugin singleusergroup version v2.9.1 [y/N]? 

Initialized /home/gerrit2/review_site

next, run the following command to rebuilt the gerrit index:

## java -jar gerrit.war reindex -d /home/gerrit2/review_site

and start the gerrit using the command below:

## /home/gerrit2/review_site/bin/gerrit.sh start

exit to root by executing the exit command.

 

5. INSTALL APACHE

Install Apache using yum:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
## yum install httpd httpd-tools openssl mod_ssl

Add the following to /etc/httpd/conf.d/options.conf

## vim /etc/httpd/conf.d/options.conf

TraceEnable off

## Disable Signature
ServerSignature Off

## Disable Banner
ServerTokens Prod
## vim /etc/httpd/conf.d/vhosts.conf

# Load my vhosts
IncludeOptional vhosts.d/*.conf
## mkdir /etc/httpd/vhosts.d

Restart Apache and add it to automatically start on your system start-up using:

## systemctl restart httpd
## systemctl status httpd
## systemctl enable httpd

 

6. APACHE PROXY TO GERRIT

## vim /etc/httpd/vhosts.d/gerrit.conf

<VirtualHost your_ip_address:80>
    ServerName your_hostname

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    <Proxy *>
		Order deny,allow
		Allow from all
    </Proxy>

    <Location /gerrit/login/>
		AuthType Basic
		AuthName "Gerrit Code Review"
		Require valid-user
		AuthUserFile '/etc/httpd/gerrit.htpasswd'
    </Location>

    AllowEncodedSlashes On
    ProxyPass /gerrit/ http://your_ip_address:8081/gerrit/
</VirtualHost>

create user using htpasswd

## htpasswd -c /etc/httpd/gerrit.htpasswd admin
New password: 
Re-type new password: 
Adding password for user admin

restart apache using

## systemctl restart httpd

next, navigate to http://your_hostname/gerrit/ and you should get the Gerrit review application loaded in your browser.

What’s Next?

Of course you don’t have to install Gerrit2 on CentOS 7,  if you use one of our CentOS VPS Hosting services, in which case you can simply ask our expert Linux admins to install Gerrit2 on CentOS 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Gerrit2 on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

9 thoughts on “How to install Gerrit2 on CentOS 7”

  1. @Admin – the errors Kuldip mentioned:::

    Exception in thread "main" com.google.inject.CreationException: Guice creation errors:

    1) Error injecting constructor, org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/gerrit2/review_site/index/changes_0008/open/write.lock
    at com.google.gerrit.lucene.LuceneChangeIndex.(LuceneChangeIndex.java:210)
    while locating com.google.gerrit.lucene.LuceneChangeIndex annotated with @com.google.inject.internal.UniqueAnnotations$Internal(value=3)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:74)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:74)
    while locating com.google.gerrit.lucene.LuceneChangeIndex
    for parameter 1 at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionListener.(LuceneIndexModule.java:88)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionListener.class(LuceneIndexModule.java:88)
    while locating com.google.gerrit.lucene.LuceneIndexModule$SingleVersionListener
    while locating com.google.gerrit.extensions.events.LifecycleListener annotated with @com.google.inject.internal.UniqueAnnotations$Internal(value=5)
    Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/gerrit2/review_site/index/changes_0008/open/write.lock
    at org.apache.lucene.store.Lock.obtain(Lock.java:84)
    at org.apache.lucene.index.IndexWriter.(IndexWriter.java:702)
    at com.google.gerrit.lucene.SubIndex.(SubIndex.java:70)
    at com.google.gerrit.lucene.SubIndex.(SubIndex.java:60)
    at com.google.gerrit.lucene.LuceneChangeIndex.(LuceneChangeIndex.java:240)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at com.google.inject.internal.DefaultConstructionProxyFactory$2.newInstance(DefaultConstructionProxyFactory.java:86)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
    at com.google.inject.assistedinject.FactoryProvider2.invoke(FactoryProvider2.java:665)
    at com.google.gerrit.lucene.$Proxy27.create(Unknown Source)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:77)
    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:483)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:105)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:107)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
    at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
    at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
    at com.google.gerrit.pgm.Reindex.createSysInjector(Reindex.java:240)
    at com.google.gerrit.pgm.Reindex.run(Reindex.java:148)
    at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:63)
    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:483)
    at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
    at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
    at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
    at Main.main(Main.java:25)

    2) Error injecting constructor, org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/gerrit2/review_site/index/changes_0008/open/write.lock
    at com.google.gerrit.lucene.LuceneChangeIndex.(LuceneChangeIndex.java:210)
    while locating com.google.gerrit.lucene.LuceneChangeIndex annotated with @com.google.inject.internal.UniqueAnnotations$Internal(value=3)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:74)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:74)
    while locating com.google.gerrit.lucene.LuceneChangeIndex
    Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/gerrit2/review_site/index/changes_0008/open/write.lock
    at org.apache.lucene.store.Lock.obtain(Lock.java:84)
    at org.apache.lucene.index.IndexWriter.(IndexWriter.java:702)
    at com.google.gerrit.lucene.SubIndex.(SubIndex.java:70)
    at com.google.gerrit.lucene.SubIndex.(SubIndex.java:60)
    at com.google.gerrit.lucene.LuceneChangeIndex.(LuceneChangeIndex.java:240)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at com.google.inject.internal.DefaultConstructionProxyFactory$2.newInstance(DefaultConstructionProxyFactory.java:86)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
    at com.google.inject.assistedinject.FactoryProvider2.invoke(FactoryProvider2.java:665)
    at com.google.gerrit.lucene.$Proxy27.create(Unknown Source)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:77)
    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:483)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:105)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
    at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
    at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
    at com.google.gerrit.pgm.Reindex.createSysInjector(Reindex.java:240)
    at com.google.gerrit.pgm.Reindex.run(Reindex.java:148)
    at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:63)
    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:483)
    at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
    at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
    at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
    at Main.main(Main.java:25)

    3) Error injecting constructor, org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/gerrit2/review_site/index/changes_0008/open/write.lock
    at com.google.gerrit.lucene.LuceneChangeIndex.(LuceneChangeIndex.java:210)
    while locating com.google.gerrit.lucene.LuceneChangeIndex annotated with @com.google.inject.internal.UniqueAnnotations$Internal(value=3)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:74)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:74)
    while locating com.google.gerrit.lucene.LuceneChangeIndex
    for parameter 1 at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionListener.(LuceneIndexModule.java:88)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionListener.class(LuceneIndexModule.java:88)
    while locating com.google.gerrit.lucene.LuceneIndexModule$SingleVersionListener
    Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/gerrit2/review_site/index/changes_0008/open/write.lock
    at org.apache.lucene.store.Lock.obtain(Lock.java:84)
    at org.apache.lucene.index.IndexWriter.(IndexWriter.java:702)
    at com.google.gerrit.lucene.SubIndex.(SubIndex.java:70)
    at com.google.gerrit.lucene.SubIndex.(SubIndex.java:60)
    at com.google.gerrit.lucene.LuceneChangeIndex.(LuceneChangeIndex.java:240)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at com.google.inject.internal.DefaultConstructionProxyFactory$2.newInstance(DefaultConstructionProxyFactory.java:86)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
    at com.google.inject.assistedinject.FactoryProvider2.invoke(FactoryProvider2.java:665)
    at com.google.gerrit.lucene.$Proxy27.create(Unknown Source)
    at com.google.gerrit.lucene.LuceneIndexModule$SingleVersionModule.getIndex(LuceneIndexModule.java:77)
    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:483)
    at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:105)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:66)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:107)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
    at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
    at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
    at com.google.gerrit.pgm.Reindex.createSysInjector(Reindex.java:240)
    at com.google.gerrit.pgm.Reindex.run(Reindex.java:148)
    at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:63)
    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:483)
    at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
    at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
    at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
    at Main.main(Main.java:25)

    3 errors
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
    at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:230)
    at com.google.gerrit.pgm.Reindex.createSysInjector(Reindex.java:240)
    at com.google.gerrit.pgm.Reindex.run(Reindex.java:148)
    at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:63)
    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:483)
    at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
    at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
    at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
    at Main.main(Main.java:25)

    Reply
  2. followed instructions and I get a 403 and in the gerrit logs: Unable to authenticate user "admin"
    com.google.gerrit.server.account.AccountException: Cannot assign external ID "gerrit:admin" to account 11; external ID already in use.

    Reply
    • The CPU Utilization depends on the maxThreads configured in server.xml , so check your server.xml configuration and adjust the maxThreads value accordingly.

      Reply

Leave a Comment