Hi,
Maybe a simple question for everyone involved, but I cannot seem to get this
to work..
I'm trying to write a mailet which does some processing on each message
which comes into our James server. I would like to use the JDBC Connection
Pool I defined in the config.xml, which is working fine as the mail flows in
and through James and the database without problem.
I tried to open a connection using the following snippet:
package com.company.my.mailets;
import java.sql.*;
import javax.mail.MessagingException;
import org.apache.mailet.*;
import org.apache.james.util.mordred.JdbcDataSource;
class processing extends GenericMailet
{
public void service(Mail mail) throws MessagingException
{
Connection conn = new JdbcDataSource().getConnection();
.....
if (conn != null) conn.close();
}
}
This does not seem to be the right way to get a connection. My Spoolmanager
logs the getConnection() as a java.lang.NullPointerException, so I am
probably not setting up the connection correctly.
How do I set up the connection properly?
Thanks a lot,
-Rogier