Difference between revisions of "Imeji install jetty"

From MPDLMediaWiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Imeji_Tech}}
'''Please note:''' Content was moved to: http://imeji.org/wordpress/install-jetty/


= Deploying imeji in a Jetty 9 server environment =
[[Category:Imeji_Content_moved|Jetty]]
 
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 ==
 
*Download and install the Jetty 9 server
 
*Install Maven 3.x
 
== Build imeji snapshot ==
 
Check out the sources, for example in /usr/local/src
 
<pre>
sudo git clone https://github.com/imeji-community/imeji.git
</pre>
 
This will produce a subdirectory "imeji" containing a "pom.xml" file. CD into the "imeji" subdir and do
 
<pre>
sudo mvn package
</pre>
 
This will download all libraries and build the entire application plus a war file (which we don't use).
 
== Properties files ==
 
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 ==
 
Create a soft link to your Imeji snapshot build directory:
 
<pre>
sudo ln -s /usr/local/src/imeji/target/imeji-1.3.0.1-SNAPSHOT /usr/local/imeji
</pre>
 
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:
 
<pre>
<?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>
</pre>
 
== Logging ==
 
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:
 
<pre>
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${jetty.home}/logs/imeji.log" />
</pre>
 
Add logging for digilib:
 
<pre>
  <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> 
</pre>
 
Add this line to the <root> element of log4j.xml:
 
<pre>
    <appender-ref ref="log"/>
</pre>
 
== imeji storage configuration ==
 
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:
 
<pre>
#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/
</pre>
 
== Digilib configuration ==
 
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:
 
<pre>
digilib.configuration.path = /usr/local/src/digilib-config.xml
</pre>
 
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 ==
 
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 [http://stackoverflow.com/questions/5973664/could-not-find-factory-javax-faces-context-facescontextfactory-using-embedded here]) add the following lines to <imeji>/WEB-INF/web.xml:
 
<pre>
<listener>
  <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>     
</pre>
 
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 [http://stackoverflow.com/questions/19123887/jetty-java-lang-illegalstateexception-zip-file-closed here])
 
<pre>
<init-param>
  <param-name>gzip</param-name>
  <param-value>false</param-value>
</init-param>
</pre>
 
[[Category:Imeji|Install]]
[[Category:Imeji_Technical_Specification|Install]]

Latest revision as of 11:01, 9 January 2014

Please note: Content was moved to: http://imeji.org/wordpress/install-jetty/