Fix running Gerrit on Tomcat

- WebAppInitializer moved to another package, fix that in web.xml
- fix Guice bindings in WebAppInitializer

Bug: Issue 10033
Change-Id: I2fafdd318f789db39b9c4a10bb3261efde30066c
This commit is contained in:
Matthias Sohn 2018-11-14 16:46:04 -08:00 committed by Luca Milanesio
parent dc79e14875
commit 72d8b133e1
2 changed files with 5 additions and 1 deletions

View File

@ -48,6 +48,7 @@ import com.google.gerrit.server.StartupChecks;
import com.google.gerrit.server.account.AccountDeactivator; import com.google.gerrit.server.account.AccountDeactivator;
import com.google.gerrit.server.account.InternalAccountDirectory; import com.google.gerrit.server.account.InternalAccountDirectory;
import com.google.gerrit.server.api.GerritApiModule; import com.google.gerrit.server.api.GerritApiModule;
import com.google.gerrit.server.api.PluginApiModule;
import com.google.gerrit.server.audit.AuditModule; import com.google.gerrit.server.audit.AuditModule;
import com.google.gerrit.server.cache.h2.H2CacheModule; import com.google.gerrit.server.cache.h2.H2CacheModule;
import com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule; import com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule;
@ -60,6 +61,7 @@ import com.google.gerrit.server.config.DownloadConfig;
import com.google.gerrit.server.config.GerritGlobalModule; import com.google.gerrit.server.config.GerritGlobalModule;
import com.google.gerrit.server.config.GerritInstanceNameModule; import com.google.gerrit.server.config.GerritInstanceNameModule;
import com.google.gerrit.server.config.GerritOptions; import com.google.gerrit.server.config.GerritOptions;
import com.google.gerrit.server.config.GerritRuntime;
import com.google.gerrit.server.config.GerritServerConfig; import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.GerritServerConfigModule; import com.google.gerrit.server.config.GerritServerConfigModule;
import com.google.gerrit.server.config.SitePath; import com.google.gerrit.server.config.SitePath;
@ -326,6 +328,7 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
modules.add(new MimeUtil2Module()); modules.add(new MimeUtil2Module());
modules.add(cfgInjector.getInstance(GerritGlobalModule.class)); modules.add(cfgInjector.getInstance(GerritGlobalModule.class));
modules.add(new GerritApiModule()); modules.add(new GerritApiModule());
modules.add(new PluginApiModule());
modules.add(new SearchingChangeCacheImpl.Module()); modules.add(new SearchingChangeCacheImpl.Module());
modules.add(new InternalAccountDirectory.Module()); modules.add(new InternalAccountDirectory.Module());
modules.add(new DefaultPermissionBackendModule()); modules.add(new DefaultPermissionBackendModule());
@ -375,6 +378,7 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
@Override @Override
protected void configure() { protected void configure() {
bind(GerritOptions.class).toInstance(new GerritOptions(config, false, false, false)); bind(GerritOptions.class).toInstance(new GerritOptions(config, false, false, false));
bind(GerritRuntime.class).toInstance(GerritRuntime.DAEMON);
} }
}); });
modules.add(new GarbageCollectionModule()); modules.add(new GarbageCollectionModule());

View File

@ -8,7 +8,7 @@
<filter> <filter>
<filter-name>guiceFilter</filter-name> <filter-name>guiceFilter</filter-name>
<filter-class>com.google.gerrit.httpd.WebAppInitializer</filter-class> <filter-class>com.google.gerrit.httpd.init.WebAppInitializer</filter-class>
</filter> </filter>
<filter-mapping> <filter-mapping>
<filter-name>guiceFilter</filter-name> <filter-name>guiceFilter</filter-name>