Gentoo: Pebble 2.3.1 on Tomcat 5.5 and Tomcat 6 (using JDK 1.5)

In Gentoo, a couple of manual configuration steps are required in order to make Pebble run on Tomcat 5.5, using JDK 1.5. So, apart from the obvious (like emerging Tomcat, a JDK, fetching pebble-2.3.1.zip etc.), I had to do the following:

  • In /usr/share/tomcat-5.5/lib, add the following two jar libraries from the pebble-2.3.1.zip archive (they’re located in the lib subdirectory):
    activation.jar
    mail.jar
    Further create symlinks to these two jars in /usr/share/tomcat-5.5/server/lib:
    o2 # cd /usr/share/tomcat-5.5/server/lib
    o2 lib # ln -s ../../lib/activation.jar .
    o2 lib # ln -s ../../lib/mail.jar .
  • Make sure these two jar files are in Tomcat’s CLASSPATH. Astonishingly, placing them in the above directories is not sufficient in Gentoo, one needs to explicitly add them to the CLASSPATH too. Thus, in /etc/conf.d/tomcat-5.5, edit the CLASSPATH to make it look as follows:
    CLASSPATH=${CATALINA_LIBDIR}:${CATALINA_LIBDIR}mail.jar:${CATALINA_LIBDIR}activation.jar
  • In /usr/share/tomcat-5.5/common/endorsed, add symlinks to xalan.jar and serializer.jar (in order to get rid of the “javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found” error message):
    o2 # cd /usr/share/tomcat-5.5/common/endorsed
    o2 endorsed # ln -s /usr/share/xalan/lib/xalan.jar .
    o2 endorsed # ln -s /usr/share/xalan/lib/serializer.jar .
    These two files are part of Xalan (’emerge xalan’, if necessary)
  • On my Gentoo server, I had to explicitly set the dataDirectory property Pebble uses, as by default, the variable ${user.home} seemed to point to /dev/null in a secured Tomcat environment. So, make sure the property file ./WEB-INF/pebble.properties in the pebble.war file defines
    dataDirectory=/var/pebbledata
    (or whatever directory you want pebble to store the actual blog data in) instead of
    dataDirectory=${user.home}/pebble
    Important: Make sure this directory (here: /var/pebbledata) exists (create it, if necessary) and is writable by Tomcat (i.e. user tomcat or group tomcat)
  • I’d suggest you rename pebble.war (from the pebble-2.3.1.zip archive) to something more generic, e.g. blog.war or news.war before deploying it to Tomcat. Like this, the relative URL for accessing the blog will automatically start with /blog or /news accordingly (instead of /pebble). The naming is a matter of taste though. To deploy the war file, simply copy it to /var/lib/tomcat-5.5/webapps and restart Tomcat (which might not even be necessary, actually):
    o2 # /etc/init.d/tomcat-5.5 restart
  • If you want to use the Tomcat Manager web application in order to monitor, start and stop webapps like pebble (you probably want to do this), make sure you define a user with the role ”manager” in /var/lib/tomcat-5.5/conf/tomcat-users.xml (this file is empty by default). E.g. add the following user:
    <tomcat-users>
    <role rolename=”manager”/>
    <user username=”tomcatmanager” password=”t0tallySecretPassw0rd” roles=”manager”/>
    </tomcat-users>

For Tomcat 6, the required changes are analogous. ASAP, I’ll verify these steps with Pebble-2.3.1 on Tomcat 6 using Sun JDK 1.6. Stay tuned..

Setting up postfix for virtual mail hosts

After setting up name-based virtual web hosting for Apache, I’ve just set up virtual mail hosting for my new company, Printscreen GmbH, using postfix – and it was amazingly simple! :) For some basic virtual mail hosting using normal UNIX/Linux user accounts, all you need is a plain-text file (‘/etc/postfix/virtual’) that maps virtual mail addresses to the actual user accounts and two additional lines in main.cf:

/etc/postfix/virtual:
postmaster@example.com postmaster
# Uncomment entry below to implement a catch-all address
# @example.com jim

/etc/postfix/main.cf:
virtual_alias_domains = example.com
virtual_alias_maps = hash:/etc/postfix/virtual

Then just execute

# postmap /etc/postfix/virtual && /etc/init.d/postfix reload

Voilà!

The nice postfix readme file for this and some more complicated virtual mail hosting configurations:

http://www.postfix.org/VIRTUAL_README.html

Another, possibly helpful howto (search):

http://www.freebsddiary.org/postfix.php

For setups using a MySQL database as a backend for storing the mappings, see Google. I currently don’t need this and hence don’t like to introduce any unnecessary MySQL dependency to my postfix server – remember the KISS principle ;)