# Modifying Tomcat configuration to work with the Discovery Framework

Before proceeding further, you must modify some Tomcat configuration files.

1. In the endeca-portal/apache-tomcat-5.5.x/bin/ directory, modify catalina.bat (on Windows) or catalina.sh (on Linux) by adding the JAVA_OPTS line. This line should appear under the line Execute The Requested Command as follows:

       set JAVA_OPTS=%JAVA_OPTS% -Xmx1024m -XX:MaxPermSize=256m -Dfile.encoding=UTF8 -Duser.timezone=GMT -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false

   This increases the memory size for the server and establishes security configuration for the Discovery Framework.
2. Modify the endeca-portal/apache-tomcat-5.5.x/conf/catalina.properties file as follows to add the ext directory to the common class loader:

       common.loader=
            ${catalina.home}/common/classes,\
            ...\
            ${catalina.home}/common/lib/ext/*.jar

3. To deploy the Discovery Framework in the root context, create a new file called ROOT.xml and place it in endeca-portal/apache-tomcat-5.5.x/conf/Catalina/localhost/. To deploy the Discovery Framework into any other context, create a new file called <context root>.xml and place it in endeca-portal/apache-tomcat-5.5.x/conf/Catalina/localhost/. For multi-level context paths, separate the name with #. For example, for a context path of /sales/east, the file name should be sales#east.xml.
4. Modify the XML file created in the previous step as needed:
   - For a root context: <Context path="" />
   - For a context of /sales: <Context path="/sales"/>
   - For a context of /sales/east: <Context path="/sales/east"/>
5. Rename the endeca-portal\apache-tomcat-5.5.x\webapps\ROOT directory to endeca-portal\apache-tomcat-5.5.x\webapps\<context root>. For multi-level context paths, use the multi-level path here: endeca-portal\apache-tomcat-5.5.x\webapps\ROOT directory to endeca-portal\apache-tomcat-5.5.x\webapps\mycompany\sales.
6. To support UTF-8 URI encoding, edit the server.xml file located in the endeca-portal/apache-tomcat-5.5.x/conf directory as follows:

       <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
          <Connector
             port="8080"
             maxHttpHeaderSize="8192"
             maxThreads="150"
             minSpareThreads="25"
             maxSpareThreads="75"
             enableLookups="false"
             redirectPort="8443"
             acceptCount="100"
             connectionTimeout="20000"
             disableUploadTimeout="true"
             URIEncoding="UTF-8"
          />