Toms Online Notebook Sharing my stuff.

Installing Apache Roller in Jetty 9

by tgutwin


Posted on Sunday Jan 24, 2016 at 05:15PM in Technology


jettyIcon.pngsteamroller5.jpgI have been using Google for my Web Based notebook Blog
for a few years, however, it did not have all the features I wanted to
use; like commenting and a tag cloud. SO, I installed my own weblog
software - Apache Roller.
I also looked at WordPress, but I wanted a Java only solution. You are
looking at it right now. This is how I got it running on Jetty.

I am going to point out how easy it was to install in a simple Java Servlet engine like Jetty,
without a full Application Server. The Roller instal docs say that all
it needs is a servlet engine, but then it goes on to only have examples
for installing in full J2EE Application Servers (JBOSS, Tomcat,
Websphere).


I use Jetty 9 on its own, without a full App server, and it was very easy to get going. My production DB is MariaDB (mySql) on Fedora 23.


I followed the very good docs available from the Roller Website --> Installation Guide


You can either build from source or get the latest stable build.


Build from source:



Fedora Dependant Packages


You'll need Maven. Here are the Fedora Packages I installed:


$ sudo yum install maven maven-release-plugin keytool-maven-plugin xmlbeans-maven-plugin maven-war-plugin maven-test-tools maven-shared-jar maven-settings maven-scm maven-release maven-rar-plugin maven-plugin-tools-java maven-plugin-tools-beanshell maven-plugin-tools-ant maven-plugin-testing-tools maven-plugin-registry maven-osgi maven-local maven-jarsigner-plugin maven-jar-plugin maven-invoker-plugin maven-gpg-plugin maven-ear-plugin maven-ant-plugin maven-dependency-plugin maven-downloader maven-common-artifact-filters maven-artifact-manager maven-artifact maven-archiver rome


Download, Build And Install Apache Roller


Download & build



    • mkdir roller

    • cd roller

    • svn co https://svn.apache.org/repos/asf/roller/trunk trunk

    • cd trunk

    • mvn clean install




Download the latest build


Or you can just download the latest build - which might be a better idea because using the trunk will NOT allow for easy upgrades.


Setup The DB


Create Database schema and user(s) - this is pretty much straight out of the Roller Installation Guide

  • I already had a MariaDB instance setup and running So I am using it...

  • mysql -u yourMySqlUserId -p

  • password: *****


    • mysql> CREATE USER 'scott'@'localhost' IDENTIFIED BY 'tiger';

    • mysql> create database rollerdb DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

    • mysql> grant all on rollerdb.* to scott@'%' identified by 'tiger';

    • mysql> grant all on rollerdb.* to scott@localhost identified by 'tiger';

    • mysql> flush privileges;

    • mysql> exit;



Jetty specific Setup


So far, this has all been standard; as per the Roller Installation Guide


Setup the Roller Properties file to point to your roller data dir and the DB username you previously setup.


  1. Copy it somewhere in the classpath - I put mine into the WEB-INF/classes dir

  2.  roller-custom.properties




    • installation.type=auto
      #installation.type=manual
      mediafiles.storage.dir=/opt/roller/data/mediafiles
      search.index.dir=/opt/roller/data/searchindex
      log4j.appender.roller.File=/opt/roller/data/roller.log
      database.configurationType=jdbc
      database.jdbc.driverClass=org.mariadb.jdbc.Driver
      database.jdbc.connectionURL=jdbc:mariadb://yourDbServerIP:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8
      database.jdbc.username=scott
      database.jdbc.password=tiger
      mail.configurationType=properties
      mail.hostname=mythtv.webarts.bc.ca
      mail.port=465
      mail.username=scott
      mail.password=tiger
      # Weblog entry plugins
      #plugins.page=\
      #org.apache.roller.ui.rendering.plugins.ConvertLineBreaksPlugin \
      #,org.apache.roller.ui.rendering.plugins.TopicTagPlugin \
      #,org.apache.roller.ui.rendering.plugins.ObfuscateEmailPlugin \
      #,org.apache.roller.ui.rendering.plugins.SmileysPlugin \
      #,org.apache.roller.plugins.weblogentry.jspwiki.WikiPlugin


  3. add some extra support jars to the WEB-INF/lib dir


  4. Comment out the JNDI references in the web.xml and sun-web.xml

  5. I put everything into a script file called wrapRoller.sh (attached)


    • #!/bin/bash
      #
      # Make sure your have the generic war file backed up first
      #
      ROLLER_VERSION=5.1.2
      ROLLER_HOME=/opt/roller/roller-release-$ROLLER_VERSION
      WEBAPP_HOME=$ROLLER_HOME/webapp
      JETTY_BASEDIR=/opt/jetty/basedir

      if [ -d $WEBAPP_HOME/roller ];
      then
        rm -R -f $WEBAPP_HOME/roller
      fi
      unzip -q $WEBAPP_HOME/roller-$ROLLER_VERSION.war -d $WEBAPP_HOME/roller
      rm $WEBAPP_HOME/roller.war
      cp /opt/jdbc/mariadb-java-client-1.1.8.jar $WEBAPP_HOME/roller/WEB-INF/lib
      cp /opt/jdbc/derbyclient.jar $WEBAPP_HOME/roller/WEB-INF/lib
      cp $ROLLER_HOME/../roller-custom.properties $WEBAPP_HOME/roller/WEB-INF/classes
      cp --remove-destination $ROLLER_HOME/../web.xml $WEBAPP_HOME/roller/WEB-INF
      cp --remove-destination $ROLLER_HOME/../sun-web.xml $WEBAPP_HOME/roller/WEB-INF
      unzip -oq /opt/roller-themes/TomsLightword.zip -d $WEBAPP_HOME/roller/themes/.
      cd $WEBAPP_HOME/roller
      zip -qr $WEBAPP_HOME/roller.war *
      cd $WEBAPP_HOME



  6. Copy Webapp war/files to Jetty baseDir/webapp

  7. Connect to the roller URL you setup 



Configure the Running Roller Instance



  1. Run through startup wizard to fill DB and create an Roller Admin user

  2. Grab the extra Themes from ...

  3. Configure settings in the roller web-app,

  4.  and get going.


My detailed configuration notes:


I installed TinyMCE weblog editor following these instructions almost exactly:



You have to use the TinyMCE distrivution version 3; I tried v4 and it does not work because the paths in the download are different than the editor-tinymce.jsp file that is created using the instructions above. You could use v4 but you would need to change the paths in the editor-tinymce.jsp file. Here is the v3 Download link:



  • http://download.moxiecode.com/tinymce/tinymce_3.5.11.zip




Migrate/restore Roller WebApp and DB


I had to recover an installed Roller and its MariaDB after a server failure.



  1. copy the MariaDB files back to /var/lib/mysql/

  2. copy the mariaDB config to etc

  3. get mariaDB running

  4. copy the /opt/roller dir back

  5. copy the jetty/basedir/webapps/roller.war

  6. now the tricky part because the user passwords salt has changed, all the passwords don't work


    1. go to the roller webpage and create a new user

    2. use the password you want to use for tgutwin

    3. the db should now have a new user in its roller_user table

    4. copy that new users password field and update tgutwin user's password field


  7. RESTART webapp  touch /opt/jetty/baseDir/webapps/roller.war

  8. delete  that non-enabled new user you created








No one has commented yet.
Comments are closed for this entry.