Imeji install jetty

From MPDLMediaWiki
Revision as of 07:35, 8 November 2013 by Kleinfercher (talk | contribs)
Jump to navigation Jump to search
Imeji logo.png

Internal
Meetings
Cooperation

Specification
Architecture
Installer
Ingest
Functional Specification
Technical Specification

Metadata
RDF mapping
Metadata terms

edit


Deploying Imeji in a Jetty 9 server environment[edit]

Since several files have to be customized first, Imeji does not work out of the box as a .war-file in a Jetty 9 server. Here are some instructions which should help to set up a working environment based on the most recent imeji snapshot from GitHub. This setup was tested on a machine running a 64bit Linux system (Debian Squeeze).

Prerequisites[edit]

  • Download and install the Jetty 9 server
  • Install Maven 3.x

Build Imeji snapshot[edit]

Check out the sources, for example in /usr/local/src

sudo git clone https://github.com/imeji-community/imeji.git

This will produce a subdirectory "imeji" containing a "pom.xml" file. CD into the "imeji" subdir and do

sudo mvn package

This will download all libraries and build the entire application plus a war file (which we don't use).

Properties files[edit]

Create the properties files as described here: Imeji_properties. The files will be picked up automatically if you put them in <jetty.home>/resources. Remember that a file named "vocabulary.properties" must also exist in this directory, even if you don't want to use vocabularies.

Web context[edit]

Create a soft link to your Imeji snapshot build directory:

sudo ln -s /usr/local/src/imeji/target/imeji-1.3.0.1-SNAPSHOT /usr/local/imeji

Put a file named "imeji.xml" in <jetty.home>/webapps. Set "contextPath" to the desired URL path and "resourceBase" to the softlink. The content should look like this:

<?xml version="1.0">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/imeji</Set>
  <Set name="resourceBase">/usr/local/imeji</Set>
  <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
</Configure>

Logging[edit]

Make sure that the user account under which Jetty is run has write privilege in Jetty's log directory <jetty.home>/logs. Edit the file "WEB-INF/classes/log4j.xml" in your Imeji snapshot directory as follows, replacing the value of the "File" parameter:

<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
	<param name="File" value="${jetty.home}/logs/imeji.log" />

Add logging for digilib:

  <appender name="log" class="org.apache.log4j.FileAppender">
    <param name="File" value="${jetty.home}/logs/imeji-digilib-log.txt"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
    </layout>
  </appender>

  <appender name="account" class="org.apache.log4j.FileAppender">
    <param name="File" value="${jetty.home}/logs/imeji-digilib-access-log.txt"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
    </layout>
  </appender>

  <logger name="account.request">
    <level value ="debug"/>
    <appender-ref ref="account"/>
  </logger>  

Add this line to the <root> element of log4j.xml:

    <appender-ref ref="log"/>

Imeji storage configuration[edit]

Create directories for Imeji where it can store data. Make sure that the user account under which Jetty is run has write privilege for both. Remember that the last element of the storage path must have the name "files". Set the paths in "imeji.properties" like so:

#Path to Jena's TDB database (RDF storage)
imeji.tdb.path = /var/local/imeji/tdb/

#Path to imeji storage (where the files are stored) (for windows use separator: \\) 
# Note: If you use digilib, the path must end with /files/ !
imeji.storage.path=/var/local/imeji/files/

Digilib configuration[edit]

Make sure that the user account under which Jetty is run has write privilege for the file "WEB_INF/digilib-config-xml" in your Imeji snapshot directory. Copy this file to somewhere else, for example to /usr/local/src. Reference the copied file in your imeji.properties file like so:

digilib.configuration.path = /usr/local/src/digilib-config.xml

Edit the copied file and set the desired config parameters for Digilib. Pay attention to the parameter "basedir-list". It must point to the parent directory of the one given in the property "imeji.storage.path" (without the final /files/ part).

Troubleshooting Jetty issues[edit]

If the /imeji context does not start and you get an exception in the log saying

could not find Factory: javax.faces.context.FacesContextFactory

(explanation here) add the following lines to <imeji>/WEB-INF/web.xml:

<listener>
   <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>      

If you get an exception in the log saying

java.lang.illegalstateexception zip file closed

edit the following lines in <jetty.home>/etc/webdefault.xml, setting "gzip" to false: (explanation here)

<init-param>
  <param-name>gzip</param-name>
  <param-value>false</param-value>
</init-param>