微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

具有HTTP基本/摘要身份验证的Gerrit 3.2.3:无法启动服务

如何解决具有HTTP基本/摘要身份验证的Gerrit 3.2.3:无法启动服务

我正在尝试使用http身份验证安装gerrit 3.2.3。我在gerrit.config和/etc/apache2/sites-enable/000-default.conf中的apache2中具有以下gerrit配置:

gerrit.conf:

[gerrit]
        basePath = git
        canonicalWebUrl = http://10.20.30.40:8444/
        serverId = ed568797-ae0c-4e44-a5ac-4a419df2349e
[container]
        javaoptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
        javaoptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
        user = gerrit
        javaHome = /usr/lib/jvm/java-8-openjdk-amd64/jre
[index]
        type = lucene
[auth]
        type = HTTP
[receive]
        enableSignedPush = false
[sendemail]
        smtpServer = mail.example.com
        smtpServerPort = 587
        smtpEncryption = TLS
        smtpUser = whoami
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = http://*:8081/
[cache]
        directory = cache

000-default.conf是:

<VirtualHost *:80>
        # The ServerName directive sets the request scheme,hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts,the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However,you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8,...,trace1,debug,info,notice,warn,# error,crit,alert,emerg.
        # It is also possible to configure the loglevel for particular
        # modules,e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/,which are
        # enabled or disabled at a global level,it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Listen 8444
<VirtualHost *:8444>
  ServerName 10.20.30.40
  ProxyRequests Off
  ProxyVia Off
  ProxyPreserveHost On

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
  <Location "/">
      AuthType Digest
      AuthName "realm"
      AuthDigestDomain /
      AuthDigestProvider file
      AuthUserFile /var/www/html/htpasswd

      # These 3 lines below for basic authentication:
      # AuthGroupFile /dev/null
      # AuthBasicProvider file
      # AuthUserFile '/home/stl/passwords'
      Require valid-user
  </Location>
  AllowEncodedSlashes On
  ProxyPass / http://10.20.30.40:8081/
</VirtualHost>

#vim: Syntax=apache ts=4 sw=4 sts=4 sr noet
#vim: Syntax=apache ts=4 sw=4 sts=4 sr noet

apache启动成功,sudo service apache2 start没有任何问题。 但是,当我尝试启动gerrit(gerrit_site / bin / gerrit.sh启动)时,出现以下错误

[2020-09-19T12:38:16.521-0400] [main] INFO  org.eclipse.jetty.server.Server : jetty-9.4.30.v20200611; built: 2020-06-11T12:34:51.929Z; git: 271836e4c1f4612f12b7bb13ef5a92a927634b0d; jvm 1.8.0_265-8u265-b01-0ubuntu2~16.04-b01
[2020-09-19T12:38:16.574-0400] [main] INFO  org.eclipse.jetty.server.session : DefaultSessionIdManager workerName=node0
[2020-09-19T12:38:16.574-0400] [main] INFO  org.eclipse.jetty.server.session : No SessionScavenger set,using defaults
[2020-09-19T12:38:16.576-0400] [main] INFO  org.eclipse.jetty.server.session : node0 Scavenging every 600000ms
[2020-09-19T12:38:16.662-0400] [main] INFO  com.googlesource.gerrit.plugins.gitiles.HttpModule : No /home/gerrit/gerrit_latest/etc/gitiles.config; assuming defaults
[2020-09-19T12:38:16.826-0400] [WorkQueue-1] INFO  com.googlesource.gerrit.plugins.deleteproject.fs.RepositoryCleanupTask : Cleaning up expired git repositories...
[2020-09-19T12:38:16.828-0400] [WorkQueue-1] INFO  com.googlesource.gerrit.plugins.deleteproject.fs.RepositoryCleanupTask : Cleaning up expired git repositories... Done
[2020-09-19T12:38:17.155-0400] [main] INFO  org.eclipse.jetty.server.handler.ContextHandler : Started o.e.j.s.ServletContextHandler@5eadc347{/,null,AVAILABLE}
[2020-09-19T12:38:17.157-0400] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.IllegalStateException: Cannot start HTTP daemon
        at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:105)
        at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:95)
        at com.google.gerrit.pgm.Daemon.start(Daemon.java:362)
        at com.google.gerrit.pgm.Daemon.run(Daemon.java:268)
        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:224)
        at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:120)
        at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:65)
        at Main.main(Main.java:28)
Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8081
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
        at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
        at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
        at org.eclipse.jetty.server.Server.doStart(Server.java:386)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
        at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:91)
        ... 12 more
Caused by: java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:220)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:345)
        ... 19 more

我不确定出了什么问题。看来来自gerrit的http守护程序正在尝试访问8081,但无法访问。

请求您协助解决此问题。预先感谢。

编辑:

我已经在ports.conf中输入了一个内容-听8444。删除内容可以解决此问题。看来apache2正在阻止该端口。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。