使用gerrit账户在centos上安装gerrit,然后集成gitweb,gerrit服务启动失败,查看日志,报错信息如下:
[2015-05-15 05:03:42,671] 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:139) at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:74) at com.google.gerrit.pgm.Daemon.start(Daemon.java:291) 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:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) 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) Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors: 1) Error injecting constructor, java.io.IOException: Permission denied at com.google.gerrit.httpd.gitweb.GitWebServlet.<init>(GitWebServlet.java:99) at com.google.gerrit.httpd.gitweb.GitWebServlet.class(GitWebServlet.java:78) while locating com.google.gerrit.httpd.gitweb.GitWebServlet 1 error at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1018) at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1040) at com.google.inject.servlet.ServletDefinition.init(ServletDefinition.java:110) at com.google.inject.servlet.ManagedServletPipeline.init(ManagedServletPipeline.java:82) at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:103) at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:220) at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:137) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:831) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:300) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:744) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) at org.eclipse.jetty.server.Server.start(Server.java:357) at org.eclipse.jetty.server.Server.doStart(Server.java:324) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:125) ... 12 more Caused by: java.io.IOException: Permission denied at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createTempFile(File.java:2001) at com.google.gerrit.httpd.gitweb.GitWebServlet.makeSiteConfig(GitWebServlet.java:149) at com.google.gerrit.httpd.gitweb.GitWebServlet.<init>(GitWebServlet.java:126) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 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.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1066) 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.InjectorImpl$2$1.call(InjectorImpl.java:1009) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1059) at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1005) ... 29 more
gerrit的安装路径是/home/gerrit/gerrit_site,
查看gerrit_site的权限和属主,可能是之前的误操作,gerrit_site目录的属主不是gerrit:gerrit,而是777:gerrit。
执行命令:chown -R gerrit:gerrit gerrit_site
修改目录权限后,重启gerrit服务,正常运行。
over!