Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

Site Under Construction by Image Added

Table of Contents

Requirements

  • The user has to install a webserver where the web application will be hosted.
    We recommend the use of jetty, because it is a lightweight webservlet container easy to set up and with few configuration expenses.
    The web application will work on other servlet containers, too.
  • Deployment of the necessary libraries
    Libraries which are used by the web application are deployed because it is not sure that there is a reachable JobScheduler instance.
  • a database connection
    A database connection to the database which holds the transfer history has to be configured.

Aufgaben des Setups

The war file jade-history-<version>.war contains some configuration files, which a updated during setup.

PfadDateiVerwendung
/WEB-INF/classeslog4j.propertieslog4j configuration to log with log4j
/WEB-INF/classeslogback.xmllogback configuration to log with logback
/WEB-INF/classeshibernate.cfg.xmldatabase configuration file

log4j.properties example

Panel
borderColorgrey
borderWidth1
borderStylesolid

# Set the log level of the root logger to WARN
log4j.rootLogger=DEBUG, consoleAppender, fileAppender
# Direct log messages to the console
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
# Direct log messages to a file
# Set the file appender to a rolling file appender with a date configuration
log4j.appender.fileAppender=org.apache.log4j.DailyRollingFileAppender
# Set the type of the pattern layout to EnhancedPatternLayout to display local timezone
log4j.appender.fileAppender.layout=org.apache.log4j.EnhancedPatternLayout
# Set the pattern layout
log4j.appender.fileAppender.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm:ss,SSS Z}]: [%t] (%F:%L) - %m%n
# Set the output file an its path
log4j.appender.fileAppender.File=${java.io.tmpdir}/JadeHistory.log
# Set the append to true, should not overwrite
log4j.appender.fileAppender.Append=true
# Set the immediate flush to true
log4j.appender.fileAppender.ImmediateFlush=true
# Set the threshold to debug mode
log4j.appender.fileAppender.Threshold=debug
# Set the date pattern when the rollover should happen (daily at midnight)
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd

logback.xml example

Panel
borderColorgrey
borderWidth1
borderStylesolid

<configuration debug="true">
<property name="PATH_FOR_LOGFILES" value="${java.io.tmpdir}"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level [%d{yyyy-MM-dd HH:mm:ss.SSS}]: [%thread] %logger [%file:%line] - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${PATH_FOR_LOGFILES}/JadeHistory.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${PATH_FOR_LOGFILES}/JadeHistory.%d.log</fileNamePattern>
<!-- keep 7 days' worth of history -->
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>[%-5level] [%d{yyyy-MM-dd HH:mm:ss.SSS}]: [%thread] %logger [%file:%line] - %msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE"/>
</root>
</configuration>

Configuration of the web application

The web application is configured in a xml file, which

  • contains the configuration of the context of the web application.
  • is named the same as the war file.
  • resides in the same directory as the war file (deployment with Jetty, Tomcat has a separate directory for context files ).

Image Added

In the configuration set the context to /jade-history-viewer to make sure the web application is reachable at http://<host>:<port>/jade-history-viewer .

When no context is configured there is still the fallback to the default setting which simply uses a context with the same name as the war file (e.g. jade-history-viewer-1.8-SNAPSHOT or jade-history-viewer-1.8-4236-26901), which

  • contains version information and therefore will get quite confused after some time.
  • changes with each new version(e.g. update of version 1.8.0 to 1.8.1).

Using a context configuration has the following advantages:

  • The (Web) adresse is easier to read as while using the version in the context.
  • The (Web) adresse doesn´t have to be changed in the bookmarks of clients each time a new version comes out.
    The configuration file has to have the same name as the war file.

jade-history-<version>.xml example

Panel
borderColorgrey
borderWidth1
borderStylesolid

<?xml version="1.0" encoding="ISO-8859-1"?>
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/jade-history-viewer</Set>
<Set name="war">/opt/web/jetty_base/webapps/jade-history-viewer-<version>.war</Set>
<Set name="extractWAR">true</Set>
</Configure>