Skip to content

RunningTheWebappInTomcat

novalis edited this page Apr 3, 2012 · 11 revisions

First, you will need to configure the opentripplanner-api-webapp with information about the location of your graph file, as well as some routing settings. See ConfiguringTheWebapp for more details.

Next, install Tomcat 6 in whatever way you prefer if it is not already present on your system. Apt-get works great on Debian-based systems.

Build OTP (including the webapp) using mvn package -DskipTests.

Use the Tomcat manager webapp to upload the opentripplanner-webapp.war and opentripplanner-api-webapp.war files.

If you are using Tomcat security, edit your Tomcat security policy, which probably lives in /etc/tomcat6/policy.d/*.policy .

Add the following:

grant codeBase "file:${catalina.base}/webapps/opentripplanner-api-webapp/-" {
    permission java.io.FilePermission "/var/lib/opentripplanner/-","read"; /* location of Graph.obj */`
     
    permission java.util.PropertyPermission "org.apache.commons.logging.LogFactory.HashtableImpl", "read";
    permission java.util.PropertyPermission "com.sun.jersey.core.util.ReaderWriter.BufferSize", "read";
    
    permission java.lang.RuntimePermission "accessClassInPackage.sun.reflect.generics.reflectiveObjects";

    /* there aren't fatal -> webapp still runs w/o them... */
    permission java.util.PropertyPermission "org.geotools.referencing.epsg-datasource", "read";
    permission java.util.PropertyPermission "org.geotools.referencing.crs-directory", "read";
    permission java.util.PropertyPermission "org.geotools.referencing.forceXY", "read";
    
    permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
    
    permission java.lang.RuntimePermission "shutdownHooks";
    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.util.http";
};

Using Tomcat 7

Switch order of the below elements in web.xml so they match the order below:

<init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>org.opentripplanner</param-value> </init-param>

<init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.sun.jersey.samples.jsonfromjaxb</param-value> </init-param>
Clone this wiki locally