1、启动Apache,端口被占用
: AH00072: make sock: could not bind to address
(0S 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。: AH00072: make sock: could not bind to address 0.0.0.:443
a
AH00451: no listening sockets available, shutting dow
AH00015: Unable to open logs
解决方法:
修改Apache端口的方法:
修改文件(一般在此目录下:Apache安装目录\conf\extra)httpd-ssl.conf 、httpd.ahssl.conf,将443端口替换为你想设置的端口
再次启动httpd.exe,这次没报错,查看了重新设置的监听端口正常:
netstat -ano|findstr 端口号
2、安装gerrit过程中缺少
mysql-connector-java-5.1.21.jar、bcpkix-jdk15on-152.jar、bcprov-jdk15on-152.jar文件,下载失败
Gerrit Code Review is not shipped with MySQL Connector/J 5.1.21 ** This library is required for your configuration. ** Download and install it now [Y/n]? y Downloading http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar ... Failed to clean up lib: E:\Gerrit\lib\mysql-connector-java-5.1.21.jar !! FAIL !! error: repo2.maven.org Please download: http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar and save as: E:\Gerrit\lib\mysql-connector-java-5.1.21.jar
解决方法:
从以前老gerrit上面包拷贝过来
3、缺少 "ssh-keygen"
Generating SSH host key ... rsa...Exception in thread "main" java.io.IOException: Cannot run program "ssh-keygen": CreateProcess error=2, 系统找不到指定的文件。
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620) at java.lang.Runtime.exec(Runtime.java:485)
at com.google.gerrit.pgm.init.InitSshd.generateSshHostKeys(InitSshd.java:108)
at com.google.gerrit.pgm.init.InitSshd.run(InitSshd.java:85)
at com.google.gerrit.pgm.init.SitePathInitializer.run(SitePathInitializer.java:92)
at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:123)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
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:497)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:159)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:100)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:56)
at Main.main(Main.java:25) Caused by: java.io.IOException: CreateProcess error=2, 系统找不到指定的文件。
at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
...
解决方法:
如果有安装git,git目录下面有这个,把对应的路径添加到环境变量。如果没有,需要安装一个。
4、报错如下:
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: connect
解决方法:
应该是找不到gerrit需要的数据库或者 设置的数据库用户没有权限登录到 mysql。如果你需要使用mysql,则需要安装gerrit之前安装mysql。
5、报错如下:
fatal: DbInjector failed
fatal: Unable to determine SqlDialect fatal: caused by java.sql.SQLException: Access denied for user 'gerrit'@'localhost' (using password: YES)
解决方法:
确保安装gerrit过程中输入的数据库存在,且设置的数据库用户有权限访问数据库,如果没有权限需要添加权限:
GRANT ALL PRIVILEGES ON 数据库名.* TO '数据库用户'@'localhost' IDENTIFIED BY '用户对应的密码';
FLUSH PRIVILEGES;
6、启动gerrit报错如下:
[2024-10-31 18:03:33,281] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) No SSH keys under .\etc
while locating com.google.gerrit.sshd.HostKeyProvider at com.google.gerrit.sshd.SshHostKeyModule.configure(SshHostKeyModule.java:26)
while locating org.apache.sshd.common.KeyPairProvider for parameter 5
at com.google.gerrit.sshd.DatabasePubKeyAuth.(DatabasePubKeyAuth.java:72)
while locating com.google.gerrit.sshd.DatabasePubKeyAuth for parameter 0
at com.google.gerrit.sshd.CachingPublicKeyAuthenticator.(CachingPublicKeyAuthenticator.java:26)
解决方法:
报错如上,把老的gerrit上面的ssh_host_key文件拷贝过来放到etc目录下面
7、报错如下:
[2024-10-31 18:08:44,932] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) No index versions ready; run Reindex 1 error at com.google.gerrit.lucene.LuceneVersionManager.start(LuceneVersionManager.java:124)
at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:74)
at com.google.gerrit.pgm.Daemon.start(Daemon.java:302)
at com.google.gerrit.pgm.Daemon.run(Daemon.java:203)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
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:497)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:159)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:100)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:56)
at Main.main(Main.java:25)
解决方法:
网上查了,很多说按照指示reindex一下:java -jar .\bin\gerrit.war reindex
有些有作用,但是我是迁移老gerrit数据的,这种操作没有用。需要把老gerrit上面的
cache和index目录拷贝过来,再重启gerrit,就可以了。
8、启动gerrit报错如下:
[2024-10-30 17:43:41,799] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
com.google.inject.ProvisionException: Unable to provision, see the following errors:1) Error injecting constructor, java.io.IOException: Unable to unmap the mapped buffer: MMapIndexInput(path="E:\Gerrit\index\changes_0025\open\segments_1")at com.google.gerrit.lucene.LuceneChangeIndex.<init>(LuceneChangeIndex.java:236)while locating com.google.gerrit.lucene.LuceneChangeIndex annotated with @com.google.inject.internal.UniqueAnnotations$Internal(value=9)1 errorat com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)at com.google.inject.assistedinject.FactoryProvider2.invoke(FactoryProvider2.java:770)at com.google.gerrit.lucene.$Proxy115.create(Unknown Source)at com.google.gerrit.lucene.LuceneVersionManager.start(LuceneVersionManager.java:155)at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:74)at com.google.gerrit.pgm.Daemon.start(Daemon.java:302)at com.google.gerrit.pgm.Daemon.run(Daemon.java:203)at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.base/java.lang.reflect.Method.invoke(Method.java:566)at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:159)at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:100)at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:56)at Main.main(Main.java:25)
Caused by: java.io.IOException: Unable to unmap the mapped buffer: MMapIndexInput(path="E:\Gerrit\index\changes_0025\open\segments_1")at org.apache.lucene.store.MMapDirectory$2.freeBuffer(MMapDirectory.java:329)at org.apache.lucene.store.ByteBufferIndexInput.freeBuffer(ByteBufferIndexInput.java:376)at org.apache.lucene.store.ByteBufferIndexInput.close(ByteBufferIndexInput.java:355)at org.apache.lucene.store.BufferedChecksumIndexInput.close(BufferedChecksumIndexInput.java:60)at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:459)at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:909)at com.google.gerrit.lucene.AutoCommitWriter.<init>(AutoCommitWriter.java:38)at com.google.gerrit.lucene.AutoCommitWriter.<init>(AutoCommitWriter.java:33)at com.google.gerrit.lucene.SubIndex.<init>(SubIndex.java:79)at com.google.gerrit.lucene.SubIndex.<init>(SubIndex.java:61)at com.google.gerrit.lucene.LuceneChangeIndex.<init>(LuceneChangeIndex.java:268)at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)at com.google.inject.internal.DefaultConstructionProxyFactory$2.newInstance(DefaultConstructionProxyFactory.java:86)at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105)at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)... 15 more
Caused by: java.lang.IllegalAccessException: class org.apache.lucene.store.MMapDirectory$2$1 cannot access class jdk.internal.ref.Cleaner (in module java.base) because module java.base does not export jdk.internal.ref to unnamed module @6bb4dd34at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)at java.base/java.lang.reflect.Method.invoke(Method.java:558)at org.apache.lucene.store.MMapDirectory$2$1.run(MMapDirectory.java:322)at org.apache.lucene.store.MMapDirectory$2$1.run(MMapDirectory.java:314)at java.base/java.security.AccessController.doPrivileged(Native Method)at org.apache.lucene.store.MMapDirectory$2.freeBuffer(MMapDirectory.java:314)... 36 more
解决方法:
老gerrit上面的是jdk1.8,而新gerrit的jdk是11,把jdk版本换成1.8就可以了。也可以使用绿色版,但是启动的时候需要带全路径。
9、Apache注册成功,但是在服务那里启动失败
解决方法:
缺少环境依赖项,例如:
没有安装:vc_redist_x64 导致的,打开链接:Apache VS17 binaries and modules download
下载vc_redist_x64并安装。
重新添加Apache为本地服务,启动服务,可以正常运行了
10、点击页面的gitweb报错如下:
[2024-11-05 11:00:17,837] [Gitweb-ErrorLogger] ERROR com.google.gerrit.httpd.gitweb.GitwebServlet : CGI: ???????????????ò?í±ê??·¨?????·??
[2024-11-05 11:00:17,837] [HTTP-32] ERROR com.google.gerrit.httpd.gitweb.GitwebServlet : Non-zero exit status (1) from C:\Program Files\Git\mingw64\share\gitweb\gitweb.bat
解决方法:
看下C:\Program Files\Git\mingw64\share\gitweb\gitweb.bat 里面是否有中文的双引号,需要改成英文的双引号。