wiki:HowToRunUnderTomcat

Version 18 (modified by stegherr, 15 years ago) ( diff )

--

Running GeoNetwork under Tomcat

GeoNetwork can be run under Tomcat.

There are three web applications (webapps) in GeoNetwork; you will find them in the web directory of the installation: geonetwork, intermap, and geoserver. For GeoNetwork to function correctly in Tomcat (or in any servlet container, for that matter), you must publish at least geonetwork and intermap; the following instructions publish all three webapps.

  1. Install Tomcat.
  2. Prepare GeoNetwork. You can either:
    1. Use the installer.
    2. Download and build from source. See HowToWorkWithSubversion for help with downloading, and HowToCompile for help with building. If you will be using McKoi, follow the instructions to use GAST to initialize the database.
  3. Copy or link to the webapps. Either:
    1. From your GeoNetwork build (or installation), copy all of the subdirectories of the web directory to the webapps directory of Tomcat. (So you will have webapps/geonetwork, webapps/intermap, etc., in your Tomcat installation.)
    2. In the directory $CATALINA_HOME/conf/Catalina/localhost of your Tomcat installation, create a configuration file for each webapp. You will have files geonetwork.xml, intermap.xml, and geoserver.xml. In the file geonetwork.xml put the following, adjusting the docBase path as necessary:
      <Context docBase="/...path_to_GeoNetwork_installation_goes_here.../web/geonetwork"
               privileged="true" antiResourceLocking="false" antiJARLocking="false">
      </Context>
      
      In the file intermap.xml put the following, adjusting the docBase path as necessary:
      <Context docBase="/...path_to_GeoNetwork_installation_goes_here.../web/intermap"
               privileged="true" antiResourceLocking="false" antiJARLocking="false">
      </Context>
      
      Same story with geoserver.xml.
  4. Make sure Tomcat is the owner of the following directories:
    1. /...path_to_GeoNetwork_installation_goes_here.../web
    2. /...path_to_GeoNetwork_installation_goes_here.../data (If this step or the next one is missing, metadata upload and GeoServer won't work. As a consequence also the little map in the search box won't be displayed.)
  5. Change the path of the GeoServer data directory:
    1. In /...path_to_GeoNetwork_installation_goes_here.../web/geoserver/WEB-INF/web.xml set the value of the parameter 'GEOSERVER_DATA_DIR' to '/...path_to_GeoNetwork_installation_goes_here.../data/geoserver_data'.
  6. Turn off Tomcat security:
    1. In /etc/init.d/tomcatXXX set 'TOMCATXXX_SECURITY' (XXX = Tomcat version) parameter to 'no'.
  7. Edit Tomcat's server.xml to set parameters as you wish.
  8. If you can't find your log files, make sure you edit /...path_to_GeoNetwork_installation_goes_here.../web/geonetwork/WEB-INF/log4j.cfg:
    1. Change 'log4j.appender.jeeves.file' to '/var/log/tomcatXXX/geonetwork.log' (XXX = Tomcat version) or wherever you want to have your logs.
  9. Do the same for intermap with /...path_to_GeoNetwork_installation_goes_here.../web/intermap/WEB-INF/log4j.cfg.
  10. Start Tomcat.

Unfortunately . . . at present stopping Tomcat does not shut down GeoNetwork cleanly. This is documented at http://www.nabble.com/Tomcat-5.5-hangs-when-hosting-GN-2.2.0--SEC%3DUNCLASSIFIED--td17660763.html. You need to make either of the modifications suggested there before you build.

Running the Z39.50 server

You'll encounter problems if you enable the Z39.50 server, because Tomcat is missing a JAR file that is included with the Jetty installation bundled with GeoNetwork.

In short, you'll need this additional step:

  1. From your GeoNetwork build, locate the file jetty/ext/xercesImpl.jar, and copy it into your Tomcat's webapps/geonetwork/WEB-INF/lib.
Note: See TracWiki for help on using the wiki.