Server Wide Configuration


There are a number of global configuration files that do not fall into any one component. They have effects that are global in scope across the server.

Some of these files are crucial, while others can be ignored by any but the most sophisticated server administrators.


In James distribution, the spring files are located under conf/context folder and splitted into a main file (james-server-context.xml) which imports 4 other files (1 per mailbox type): james-mailbox-jcr-context.xml, james-mailbox-jpa-context.xml, james-mailbox-maildir-context.xml, james-mailbox-memory-context.xml.

Consult spring-server.xml in SVN to get some examples and hints.

spring beans files are the place where the Apache James Server wiring is done. It should be modified only by expert-users.

In combination with and META-INF/persistence.xml, the datasource to access the database is defined in spring-server.xml

Consult in SVN to get some examples and hints.

The database connection in

James has the capacity to use a JDBC-compatible database for storage of both message and user data. This section explains how to configure James to utilize a database for storage.

To avoid vendor-specific issues, the JPA (Java Persistence Architecture) is used (using the Apache OpenJPA implementation).

There must be a database instance accessible from the James server. An account with appropriate privileges (select, insert, delete into tables, and on initial startup creation of tables) and with sufficient quota for the data to be inserted into the database must be available.

Also, since James will use JDBC to access the database, an appropriate JDBC driver must be available for installation. You can place the JDBC driver jar in the conf/lib folder, it will be automatically loaded.

he class name of the database driver to be used.
The JDBC connection URL for your database/driver.
The user id of the database account to be used by this connection.
The password of the database account to be used by this connection.
true or false - Use streaming for Blobs. This is only supported on a limited set of databases atm. You should check if its supported by your DB before enable it. See (#7.11. LOB Streaming).

Note for postgresql databases: Add standard_conforming_strings=off to your postgresql.xml, otherwise you will get ""Invalid escape string Hint: Escape string must be empty or one character. {prepstmnt 174928937 SELECT t0.mailbox_id, t0.mailbox_highest_modseq, t0.mailbox_last_uid, t0.mailbox_name, t0.mailbox_namespace, t0.mailbox_uid_validity, t0.user_name FROM public.james_mailbox t0 WHERE (t0.mailbox_name LIKE ? ESCAPE '\\' AND t0.user_name = ? AND t0.mailbox_namespace = ?) [params=?, ?, ?]} [code=0, state=22025]"


Consult META-INF/persistence.xml in SVN to get some examples and hints.

The JPA mapping and properties are defined in the in META-INF/persistence.xml.

You can override the definition in external file and importing the external file in the persistence.xml (see jpa-mappings.xml provided example in SVN)


Consult in SVN to get some examples and hints.

This is used to configure the JMX MBean server via which all management is achieved (also used by via the james-cli).

The IP address (host name) the MBean Server will bind/listen to.
The port number the MBean Server will bind/listen to.

To access from a remote location, it has been reported that is needed in the startup script.


Consult sqlResources.xml in SVN to get some examples and hints.

This file is deprecated but some mailets... still need it. The standard way to access database is JPA, but some functionalities are not yet migrated and still need the sqlResources.xml resources.

The precise SQL statements used by Apache James Server to modify and view data stored in the database are specified in sqlResources.xml file.

If you are using a SQL database with unusual SQL commands or data types, you may need to add special entries to this file. The James team does try to keep sqlResources.xml updated, so if you do run into a special case, please let us know.

Also, if the database tables are not created a priori, but rather are to be created by James upon startup, special attention should be paid to the "create table" statements in this file. Such statements tend to be both very database and very database instance specific.

JCR Repository Configuration

Consult jcr-repository.xml in SVN to get some examples and hints.

Used to configure the JCR mailbox (if configure in mailbox.xml).