Chapter 2. Installing Sesame

Table of Contents

2.1. Library installation
2.2. Server installation
2.2.1. Required software
2.2.2. Installation under Tomcat 4 or 5
2.2.3. Testing Your Installation
2.2.4. Installation under Tomcat 3
2.2.5. Installation under Oracle Container for Java (OC4J)
2.2.6. Installation under other servlet containers
2.3. More on the DBMS
2.3.1. Notes on PostgreSQL
2.3.2. Notes on MySQL
2.3.3. Notes on Oracle
2.4. Java servlet container

Sesame can deployed in several ways. The two most common scenarios include deployment as a java library, or deployment as a server. In this chapter, both installation scenarios are explained.

2.1. Library installation

To use Sesame as a library in a java application, one needs the Sesame jar file sesame.jar. This file can be found in the lib/ directory of the binary download. Simply including this jar file in your classpath will allow you to use the functionality of Sesame in your own Java application.

Sesame requires Java 2, version 1.4 or newer, to function properly.

For more information on how to use Sesame as a library, see Chapter 7, The Sesame API

2.2. Server installation

2.2.1. Required software

The Sesame server requires the following software:

  • Sesame itself
  • A Java servlet container (running Java 2 1.4 or newer) for running the Sesame servlets

Sesame has several options for storage of RDF data: it can store data in main-memory (optionally with a dump to file), it can store data directly in files, or it can store data in a relational database. For the last option, Sesame installation additionally requires the presence of a DBMS with a JDBC-driver. Currently, PostgreSQL, MySQL, MS SQL Server and Oracle databases are supported. The former two DBMS's are open source and are freely available on the Internet. What follows is a description of necessary actions to get a Sesame server up-and-running.

2.2.2. Installation under Tomcat 4 or 5

The following steps describe the easiest procedure to install Sesame on Tomcat 4.x or 5.x. The described procedure doesn't require any reconfiguration of Tomcat itself, but it might not be the best option for you. Please see the documentation that came with your copy of Tomcat if you want more fine-grained control over where and how Sesame should be installed.

  1. Install Tomcat. This usually consists of downloading the binary Tomcat distribution from http://jakarta.apache.org/tomcat and installing it in an appropriate location on your harddrive (we will refer to this location as [TOMCAT_DIR] here). Please see the Tomcat documentation for more information on how to get it up and running.
  2. Go to the web applications directory ([TOMCAT_DIR]/webapps/ by default) and create a directory 'sesame' there.
  3. Extract the sesame.war file (which can be found in the lib directory of the binary Sesame distribution) to the newly created 'sesame' directory. You can do this on the command line by changing directories to the new 'sesame' directory and executing the command jar -xf [PATH/TO/]sesame.war. You can also use a program like WinZip or unzip to extract the archive. We will refer to the directory where you have extracted the sesame.war file as [SESAME_DIR] in the rest of this document.
  4. In case you are planning to use a database with Sesame, copy the appropriate JDBC-driver file(s) to the directory [SESAME_DIR]/WEB-INF/lib/.
  5. Copy the file [SESAME_DIR]/WEB-INF/system.conf.example to [SESAME_DIR]/WEB-INF/system.conf. NOTE: only do this for a fresh install of Sesame, if you are upgrading you will already have a config file, and copying the example over it will destroy your existing configuration. The example file contains some repository entries for different Sails and databases, and one user account. The file may require some modifications in order to work on your machine. Please check out Server administration if you want to learn how to do this.
  6. (Re)start your Tomcat server and Sesame should now be up and running. You can access the Sesame web interface at http://[MACHINE_NAME]:8080/sesame.

2.2.3. Testing Your Installation

If you have performed all of the steps described above, Sesame should now be ready. Make sure that your servlet container runs the (updated) Sesame code. For some servlet containers this means that you have to stop and (re)start it. Pointing a browser to the location where you have installed Sesame (e.g. http://[MACHINE_NAME]:8080/sesame/ if you have installed Sesame as described in this document) should now display the Sesame web interface.

You should also test whether the Sesame servlets are running correctly, and whether Sesame can talk to the DBMS (if applicable). Select one of the repositories that you have just configured and press 'Go>>'. Click on the 'Add (www)' link in the toolbar at the top of the window, and try to upload the test.rdf file from Sesame's admin directory (e.g. http://[MACHINE_NAME]:8080/sesame/admin/test.rdf). You can do this by typing this URL in the first text field and by clicking on the 'Add data' button after that.

If the data-upload was a success, you should also be able to extract the uploaded data. Click on the 'Extract' link in the toolbar and press the 'Extract' button. This should yield an RDF document describing all classes and properties in the repository.

Sesame has been successfully installed if all of this works. You can remove or reconfigure the test user account and repository if you want. If you haven't done so already, you can take a look at the next chapter for information on how to add and remove user accounts and repositories to/from Sesame.

2.2.4. Installation under Tomcat 3

Installation of Sesame under Tomcat 3 is almost identical to the procedure described above. It requires one additional step:

  1. Perform the steps described in Installation under Tomcat 4 or 5.
  2. Copy the file [SESAME_DIR]/WEB-INF/lib/web.xml-2.2 over the existing web.xml file and (re)start your Tomcat server.

2.2.5. Installation under Oracle Container for Java (OC4J)

Sesame has been tested with OC4J v9.0.3.0. The installed procedure differs from the standard installation procedure.

  • Create a directory [OC4J_HOME]/j2ee/home/applications/sesame and extract the sesame.war file there. We will refer to the directory where you have installed Sesame as [SESAME_DIR] in the rest of this document.
  • Remove the files [SESAME_DIR]/WEB-INF/lib/xercesImpl.jar and [SESAME_DIR]/WEB-INF/lib/xml-apis.jar since there is an incompatabilty with the OC4J XML parser.
  • Modify the SAX parser that is specified in [SESAME_DIR]/WEB-INF/web.xml as follows:
    <param-name>org.xml.sax.parser</param-name>
    <param-value>oracle.xml.parser.v2.SAXParser</param-value>
    [...]
    <param-name>org.xml.sax.driver</param-name>
    <param-value>oracle.xml.parser.v2.SAXParser</param-value>
  • Add the following line to [OC4J_HOME]/j2ee/home/config/application.xml:
    <web-module id="sesame" path="../../home/applications/sesame"/>
  • Add the following line to [OC4J_HOME]/j2ee/home/config/http-web-site.xml:
    <web-app application="default" name="sesame" root="/sesame"/>

2.2.6. Installation under other servlet containers

Sesame Server is extensively tested in combination with Apache Tomcat. Additionally, it has been reported to work with OC4J (see the previous section for configuration details) and with BEA WebLogic 8.1 SP2.

So far, we have no experience with installing Sesame under other servlet containers. Installation will probably be very similar to installation under Tomcat. Please check the documentation for your servlet container on how to install a Java web archive.

If you have successfully installed Sesame under another servlet container, then please share any container-specific installation quirks with us so that we can include the procedure in this document.

2.3. More on the DBMS

In most cases, Sesame depends on a DBMS for storing the RDF data. Currently, Sesame is able to use PostgreSQL, MySQL, Oracle (9i or newer) and SQL Server. Both PostgreSQL and MySQL are distributed under an Open Source license. These databases can be downloaded from www.postgresql.org and www.mysql.com, respectively. Please check the documentation delivered with these databases for any questions on how to get them installed.

In general Sesame performs better with MySQL than with PostgreSQL. We have no data on its performance with Oracle or SQL Server.

If you wish to use Sesame using the main-memory storage, installation of a DBMS is not required.

2.3.1. Notes on PostgreSQL

  • Sesame has been tested with versions of PostgreSQL starting from 7.0.2. Compatability with older versions is unknown.
  • JDBC-drivers for PostgreSQL can be found at http://jdbc.postgresql.org.
  • Make sure that the PostgreSQL server is running with the TCP/IP connections enabled. If TCP/IP is not enabled, the JDBC-driver will not be able to talk to the server.
  • Sesame will need a user account on the PostgreSQL server. You can create a new user account in PostgreSQL with the command createuser. We'll assume that the user is called 'sesame' in the rest of this document. PostgreSQL will ask you whether the new user should be able to create new databases or more users. You can answer both questions with 'no'.
  • Create a new database called 'testdb'. You can do this with the command createdb testdb. This database will be used later on to test whether Sesame has been correctly installed and can be removed after this has been confirmed.

2.3.2. Notes on MySQL

  • Sesame has been tested with versions of MySQL starting from 3.23.47. Versions older than 3.23.0 are known to be incompatible with the current implementation. Compatability with intermediate versions is unknown. MySQL 4.x seems to perform somewhat better than version 3.x.
  • Sesame uses the character set features that were introduced in MySQL 4.1 to properly handle non-ASCII characters, if available. Sesame will automatically detect whether these features are available and will fall back to using BLOBs when an older version of MySQL is used. In that case, Sesame will not be able to properly handle non-ASCII characters in literals and namespace names.
  • JDBC-drivers for MySQL can be found at http://www.mysql.com/downloads/api-jdbc.html. Several people have reported unexplainable errors when using the version 3.0.6 JDBC-driver. If you are having problems while using this driver too, please try using either newer JDBC drivers or the older 2.0.14 driver. We would appreciate it if you report these problems anyway. You can use the forums at www.openrdf.org for this.
  • Sesame will need a user account on the MySQL server. You can create a new user account in MySQL by connecting to the mysql database mysql -u root -p mysql, and by granting the user all privileges on the concerning database(s), e.g.:
    GRANT ALL ON <DATABASE>.* TO <USER>@localhost;
    See http://www.mysql.com/doc/G/R/GRANT.html for MySQL's syntax of GRANT. We'll assume that the user is called 'sesame' in the rest of this document.
  • Create a new database called 'testdb'. You can do this with the command mysqladmin -u root -p create testdb. This database will be used later on to test whether Sesame has been correctly installed and can be removed after this has been confirmed.

2.3.3. Notes on Oracle

  • Sesame has been tested with Oracle 9i. It has been reported that Oracle 8i does not work, due to lack of support for left (outer) joins. Oracle 9.2.0.1.0 has a bug affecting ANSI-style left (outer) joins which makes it incompatible with Sesame. It has been reported that 9.2.0.4.0 works correctly.
  • The JDBC driver can be found at [ORACLE_HOME]/jdbc/lib/classes12.jar or at http://otn.oracle.com/.
  • You will have to create a user with appropriate rights (resource + connect).
  • If ORA-0150 (maximum key length (...) exceeded) is raised during creation of your DB-Schema the reason might be in your DB configuration. You have got the following options:
    • Increase db_block_size in your init.ora and create a new database to allow larger index columns (refer to Oracle Note:136158.1).
    • Edit Oracle.java in package org.openrdf.sesame.sailimpl.rdbms and alter the size of the Datatype NAME and LABEL. The new size can be calculated from the error message, e.g.: "ORA-01450 maximum key length (3166) exceeded at varchar(3157)" (length-9 for block overhead).

2.4. Java servlet container

Sesame should be able to run on any Java servlet container that supports the Servlet 2.2 and JSP 1.1 specifications, or newer. So far, it has been tested with Tomcat and, in the case of Oracle, with OC4J. It has also been reported to work without problems on BEA WebLogic 8.1 SP2. Please post any reports about compatibility with other servlet containers to our forums.

Tomcat is distributed under the Apache Software License, which is an open source license. It is being developed as part of the Jakarta Project. Tomcat can be downloaded from jakarta.apache.org. We suggest that you use version 4 or 5 of Tomcat, as its configuration is much easier than that of older Tomcat versions (i.e. version 3).

To run Tomcat, you'll also need a Java 2 SDK. Java 2 SDK's are available for most mainstream platforms. JSDK's for Microsoft Windows, Linux x86 and Solaris can be downloaded from java.sun.com/j2se/. Please note that Tomcat requires the Java 2 SDK to be able to parse JSP pages. Sesame's JSP pages will not work if you use the Java 2 Runtime Environment.

Installation of both the JSDK and Tomcat should be straightforward. Please see the installation manuals of both software packages if you have any questions about their installation.