Running Xindice with Tomcat
Intended audience
This How-to is aimed at developers or administrators who want to install Xindice with Tomcat.
Prerequisites
The most important prerequisite is patience. Take lots of deep breaths. It will work. It just might take some time.
- You should have already compiled Xindice.
- You must have an existing installation of Tomcat. You should use version 4.1.12 or higher. You can download Tomcat from the Jakarta website.
- Be sure to set the CATALINA_HOME environmental variable to point to the location of your Tomcat installation.
Steps
Place holders used in the Steps
- {XINDICE_HOME} - Directory where you have unzipped your Xindice source files.
- {JAVA_VERSION} - Installed JDK Version.
Copy the WAR file
If you've followed the prerequisites, then you will have a working version of Tomcat installed, and the sources of Xindice compiled. Now, copy the xindice-*.war file from {XINDICE_HOME} to the %CATALINA_HOME%/webapps.
Here's what that looks like in Windows:
> cd {XINDICE_HOME} > dir xindice-* Directory of {XINDICE_HOME} 09/27/2007 09:24 PM 628,694 xindice-1.2.jar 09/27/2007 09:24 PM 5,184,315 xindice-1.2.war 09/27/2007 09:24 PM 1,791 xindice-1.2.xml 09/27/2007 09:24 PM 6,535 xindice-dom-1.2.jar 4 File(s) 5,821,335 bytes 0 Dir(s) 3,745,992,704 bytes free > copy xindice-1.2.war %CATALINA_HOME%\webapps\xindice.war 1 file(s) copied.
If you are using Linux, your session might resemble:
$ cd {XINDICE_HOME} $ ls xindice-* xindice-1.2.jar xindice-1.2.war xindice-1.2.xml xindice-dom-1.2.jar $ cp xindice-1.2.war $CATALINA_HOME/webapps/xindice.war
Edit the Tomcat's server.xml File (Optional)
Tomcat will automatically deploy copied war file with the default settings. To modify those defaults, CATALINA_HOME/conf/server.xml file should be edited. Suggested changes for the server.xml file are contained in the {XINDICE_HOME}/xindice-1.2.xml file.
Restart Tomcat
Restart your Tomcat server to be certain that it picks up the Xindice servlet. This step is required if you have edited CATALINA_HOME/conf/server.xml file. In other cases, it is usually not required.
Here's what that looks like in Windows
> cd %CATALINA_HOME%\bin > startup Using CATALINA_BASE: D:\jakarta-tomcat-4.1.12 Using CATALINA_HOME: D:\jakarta-tomcat-4.1.12 Using CATALINA_TMPDIR: D:\jakarta-tomcat-4.1.12\temp Using JAVA_HOME: C:\j2sdk{JAVA_VERSION}
Here's what that might look like on Linux
$ cd $CATALINA_HOME/bin $ ./catalina.sh start Using CATALINA_BASE: /var/tomcat4 Using CATALINA_HOME: /var/tomcat4 Using CATALINA_TMPDIR: /var/tomcat4/temp Using JAVA_HOME: /usr/java/jdk{JAVA_VERSION}
Verify the installation
When Tomcat restarts on Windows, you should see a new window open entitled 'Tomcat', and it should look something like this. (Note the xindice classes loading.)
Nov 21, 2002 1:42:07 PM org.apache.commons.modeler.Registry loadRegistry INFO: Loading registry information Nov 21, 2002 1:42:07 PM org.apache.commons.modeler.Registry getRegistry INFO: Creating new Registry instance Nov 21, 2002 1:42:08 PM org.apache.commons.modeler.Registry getServer INFO: Creating MBeanServer Nov 21, 2002 1:42:09 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone Apache Tomcat/4.1.12 Nov 21, 2002 1:42:21 PM org.apache.xindice.core.Database setConfig INFO: Database points to D:\jakarta-tomcat-4.1.12\bin\.\db Nov 21, 2002 1:42:23 PM org.apache.xindice.server.XindiceServlet init INFO: Database successfully started Nov 21, 2002 1:42:24 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on port 8080 Nov 21, 2002 1:42:24 PM org.apache.jk.common.ChannelSocket init INFO: JK2: ajp13 listening on tcp port 8009 Nov 21, 2002 1:42:24 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=20/70 config=D:\jakarta-tomcat-4.1.12\conf\jk2.properties
Here's what the $CATALINA_HOME/logs/catalina.out output looks like on Linux
[INFO] Registry - -Loading registry information [INFO] Registry - -Creating new Registry instance [INFO] Registry - -Creating MBeanServer [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone Apache Tomcat/4.1 Server 1.6 is running Press [Ctrl]+[C] to abort [INFO] Http11Protocol - -Starting Coyote HTTP/1.1 on port 8080 [INFO] ChannelSocket - -JK2: ajp13 listening on tcp port 8009 [INFO] JkMain - -Jk running ID=0 time=4/168 config=/var/tomcat4/conf/jk2.properties
In addition, you should be able to verify that xindice is running by loading this URL in your browser http://localhost:8080/xindice. If it works, you should see the Xindice "List Databases" page which allows you to browse the contents of the database.
If you run into problems, don't worry. Be sure to send feedback so that we can improve these documents for the next person.
by Dave Viner, Vadim Gritsenko
1.2