# Gerrit on tomcat

## schnitten

Hi,

trying to setup a gerrit code review application on tomcat.

I followed the gerrit installation guide(http://gerrit.googlecode.com/svn/documentation/2.0/install.html) to setup mysql correctly. Then I ran java -jar gerrit.war init to setup the initial gerrit configuration. The database gets populated with a whole lot of tables, so I guess basic setup is working. If I use the integrated jetty I even can connect to the gerrit start page.

Then I copied gerrit.war to /var/lib/tomcat-7/webapps and tried to deploy it by pushing "start" in the manager application. This gives me an error

```
FAIL - Application at context path /gerrit could not be started
```

and in /var/log/tomcat-7/catalina.log I see

```

Aug 14, 2012 12:40:14 PM org.apache.catalina.loader.WebappClassLoader validateJarFile

INFO: validateJarFile(/var/lib/tomcat-7/webapps/gerrit/WEB-INF/lib/servlet-api-6.0.29.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

Aug 14, 2012 12:40:16 PM org.apache.catalina.core.StandardContext startInternal

SEVERE: Error listenerStart

Aug 14, 2012 12:40:16 PM org.apache.catalina.core.StandardContext startInternal

SEVERE: Context [/gerrit] startup failed due to previous errors

Aug 14, 2012 12:40:16 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads

SEVERE: The web application [/gerrit] appears to have started a thread named [com.google.inject.internal.util.$Finalizer] but has failed to stop it. This is very likely to create a memory leak.

Aug 14, 2012 12:40:16 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

SEVERE: The web application [/gerrit] created a ThreadLocal with key of type [com.google.inject.internal.InjectorImpl$1] (value [com.google.inject.internal.InjectorImpl$1@deea66]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@eeefcf]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

```

I am using www-servers/tomcat-7.0.27 and copied over a tomcat-dbcp.jar from a tomcat6 binary to /usr/share/tomcat-7/lib

Any ideas what's going wrong here or how I can continue debugging?

thanks

Christian[/quote]

----------

## gerdesj

This would appear to be the problem:

```
Aug 14, 2012 12:40:14 PM org.apache.catalina.loader.WebappClassLoader validateJarFile 

INFO: validateJarFile(/var/lib/tomcat-7/webapps/gerrit/WEB-INF/lib/servlet-api-6.0.29.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class 
```

I Googled for the spec and section 9.7.2 is pretty short.  Without looking further into this, how about trying Tomcat 6 to see if that is not offended by the code in gerrit.

EDIT: I've just had a look at the Gerrit install instructions and they only really mention Jetty.  I'll bet they don't test against Tomcat.

Cheers

Jon

----------

