A Few Words On Apache James

One of the applications that I will run on this site is the Apache James email server. One of the reasons I am using this is because it is written in Java, so it helps fulfill the site’s mission of promoting Java.

Briefly, I will discuss what James is, why I have decided to use it, and then a few words on how I will configure it and what my plans are.

James is an email and news server written in Java. It runs within Apache Avalon, which from what I can gather is some sort of a container or kernel, similar to Pico Container, Tomcat or Spring. Avalon has been dropped as an Apache project and absorbed within Apache Excalibur. There are references in the file names, scripts and documentation to “Phoenix”, which appears to be some sort of code name for Avalon, just as Catalina is a code name for Tomcat.

The configuration is handled by a (very large) xml file. James can handle SMTP and POP protocols. It can be configured to store emails and user information either in a database, or on a filesystem.

I have run a few other domains on VPS servers as practice. A lot of the users opted to use Google Mail or a third-party email provider,  like FastMail or HushMail. I decided to run a mail server myself, although I may wind up regretting that.

Another reason that I chose James is that it can handle SMTP and POP. SMTP is used to send emails from one email server to another. POP is used by client applications (such as Columba, Thunderbird or Outlook) to read email on a server. There is also another protocol to retrieve mail called IMAP, but I did not have any interest in that.

Looking around, I noticed that not all email servers were able to handle both sending and retrieving. I only wanted to configure one server. There is one called Courier, but I was a put off  by some of the documentation. I found a few web pages with titles like, “Configuring an Email Server with Postfix AND Courier AND Amavis  AND ClamAV AND SpamAssassin AND MySQL blah blah blah etc etc”. That sounds like more that I wanted to handle. It turns out that James can be difficult to configure, but only dealing with one server just suits me better.

A lot of the servers that did both protocols either did not run on Linux, were proprietary (yes, there is proprietary software that runs on Linux), or was part of a collaboration or groupware suite with lots of stuff I did not want (like calendaring or scheduling). There was another Java email server called the “Java Email Server”, but I was not able to get that to run as a service via a script on /etc/init.d. Either I would have to hit Control-C or run a “kill” command. I could have tried using the Java wrapper from Tanukisoft, but once again I wanted to just use one thing.

I plan on writing about how I am going to install and configure James. There is a quick start guide on Apache’s site, that I will wind up parroting at first. It is easy to get a James server running that receives emails via SMTP, and can allow a client to read them via POP and to store information on the filesystem. Setting it up to handle SMTP authentication or send email to non-existent users to the database takes more configuration. Beyond that, the documentation is pretty scattered in wikis, web pages and the mailing list. Granted, putting more stuff on yet another blog might make that worse, but at least things should go in a linear fashion. I will also reference the default config.xml file as I go forward and make changes.


2009-02-15 23:49:37 Sunday CST -0600

Image from Physiologus Bernensis, a manuscript made in Reims around 830.  The manuscript is at Burgerbibliothek of Berne  (Wikipedia page here), image from e-Codices, assumed allowed under Fair Use.

I may look for something to replace Apache James

I think I may soon look for another mail server to replace Apache James. Right now I am using 2.3.2, which will someday be obsolete. I downloaded the new version, 3.0-M2. It looks like Apache James may no longer be a mail server that can be used by “retail users”. I am running it on a VPS account with 512 MB of memory.

The new version has IMAP. It also uses OpenJPA and Spring (before it was using some other Dependency Injection framework from another Apache project that almost nobody else used). It can be managed via JMX. The project seems to be geared towards the “Enterprise”. James 2 uses ~60 jar files. James 3 uses about 125.

I ran James 3 on my desktop to see if I could port my admin web app to James 3. Unlike James 2, James 3 does not create the tables upon startup. I emailed the list and I was told that I would have to add some users or domains in order to create tables. I was told via the email list that I could add a user via JMX or the remote manager (which I just do not like).

So I started James 3, and then I started jconsole. I was able to connect to James via jconsole. But I was not clear on what to do after that. For example, I saw a screen for adding a user. But the parameters on the form/screen are labelled “p1”, “p2” and “p3”. I assumed having worked with James 2 that they would be username, encrypted password, and encryption algorithm, but it would be nice if jconsole was clearer on this. I tried adding a user. I put “SHA-256” in the last field, and I got an exception message telling me “user repository does not exist: SHA-256”. Looking in other windows, I found that there is a repository called “LocalUsers”. I tried that and got a message about java.rmi.UnmarshalException. So I decided to stop at that point.

Then I tried the remote manager. I really do not like the remote manager. I do not like having unnecessary services and ports open. But I thought that until I get some tables created I have no choice. I logged in, and I tried a few commands. I tried adding a user a couple of times and adding a domain. Each time the remote manager hung, and I had to kill James. I could run the commands to list users and domains. The only command that returned any information was the command to list domains, but it only listed the domains that I put in the domainslist.xml file. So no tables were created.

So I think I will start looking for another email server. Perhaps I will try to write one myself in Groovy. I have started looking into Groovy and Grails again recently. I would rather run something myself than use GMail.

Image from Wikimedia, assumed allowed under Fair Use. Image from the Vatican Virgil, a 5th century manuscript of poems by Virgil.

2010-05-27 Update

The James Admin Web App is currently on hiatus. I updated the files, but someone tried it and I did not upload the jsp files.  I must have done something wrong in git on my machine. Plus my hard drive is having issues. Based on Google searches of the error messages, I think I just need a new power supply.

Update on James Admin Web App

I made a few changes and cleaned up the James Admin Web App. I also added a few pages on the wiki explaining a bit on how to configure it and use it. I will post an announcement soon the James mailing list. Perhaps I will get some more response.

I posted that I planned on changing from JSF to Struts 2 since I see more demand for Struts 2 in the marketplace, but someone posted that I should stick with JSF since that is the official JEE standard. It was nice to see another person commenting on my project.

 Image from Wikimedia, assumed allowed under Fair Use. Image from the Roman Vergil, a 5th century manuscript of poems by Virgil.

Update on James Admin Web App

I am “Maven-izing” the James Admin Web App. It took a while. I was having a problem getting the Faces Servlet to work. I would either get blank areas on the screen, or the exception “java.lang.RuntimeException: Cannot find FacesContext”.

Part of the problem was the line with the tag library URL. This is what worked in NetBeans when I was using the NetNeans project format:

<%@ taglib uri=”http://java.sun.com/jsf/core”      prefix=”f” %>

Here is what worked:

<%@ taglib uri=”http://java.sun.com/jsf/core” prefix=”f”%>

Yes, those spaces before the word “prefix” and between the “f” and the percent sign made all the difference. I do not know exactly why that is. I did some Googling, and I was not able to find anyone else who had this problem.

 Image from Wikimedia, assumed allowed under Fair Use. Image from the Roman Vergil, a 5th century manuscript of poems by Virgil.

James Admin Web App

I posted an announcement about the James Admin Web App to the James developer list:

I started a project on GitHub that is a web project that people can use to perform some administrative tasks on a James mail server.

The URL is http://github.com/emacadie/James-Admin-Web-App

It works with the James 2.3 schema. It does not work with James servers that store messages and user info on the filesystem. There have been some requests/complaints for an easier way to perform some admin tasks in James. I found a link to something on sourceforge on the James wiki, but that project was abandoned.

It is still a bit rough, but right now, you can add, delete and list the users, as well as get a count of messages in the deadletter table, delete the messages in the deadletter table and get a count of the messages for each account in the inbox.

I use Hibernate and MySQL. I assume it would work with other databases, but I have not tried to set up another database with my James server.

I am starting to look into the code for James 3. Perhaps James 3 makes this obsolete. Right now the documentation is pretty sparse. Anyway, try it out and let me know what you think.

 Image from Wikimedia, assumed allowed under Fair Use. Image from the Roman Vergil, a 5th century manuscript of poems by Virgil.

2010-03-17 Update

I presented last night at Chicago Java Users Group. I went to a big Oracle seminar and talked about the latest news about the Oracle/Sun merger. We also had a presentation by Bjorn Freeman-Benson of New Relic.

I have started learning some new technologies. I am still a Java guy, but I am looking into Ruby as well. A few people in the past month tell me that if I knew more Ruby they could hire me right now.

I am also learning Drupal. I am now running Drupal and WordPress on my VPS. It is dog slow. I think it might be because I am running Drupal on PostgreSQL. I am trying out PostgreSQL for the first time. Maybe I need to configure it better, or maybe running two databases on a VPS with 300 MB of memory is just not a good idea. I may try setting up Drupal with MySQL and see if it is any faster.

I am also working on a small web app to administer a James server. I am doing it in JSF with Hibernate. I mentioned it on the list, and there was not much interest in it. I will keep it up anyway since I am trying some new stuff.

 Image from Wikimedia, assumed allowed under Fair Use. Image from the Roman Vergil, a 5th century manuscript of poems by Virgil.

2010-01-06 Update: James and CJUG

There is some activity going on with Apache James: some progress is being made replacing the Avalon dependency injection framework with Spring. This will make James easier to update going forward. The project has been stalled somewhat in the recent past. That is one reason I found the documentation to be hard to navigate.

I plan on giving a talk at the next Chicago Java Users Group meeting on configuring Apache James. The next meeting will be on January 19. There will also be talks on Guice and Apache Jackrabbit.

 Image from Wikimedia, assumed allowed under Fair Use. Image from the Roman Vergil, a 5th century manuscript of poems by Virgil.