Are there restrictions to accessing a MySQL database from within a Mailet?
James is currently on a Linux box and is configured to use MySQL. I've created a
Mailet that checks to see if the recipients are listed in a non-James MySQL table.
Tailing the mailet log file, I can see the mailet in question outputting log messages
but I'm not getting the expected results. Furthermore, the MySQL log file isn't
showing any activity.
Any ideas?
I've attached the code in question. The last message I see in the mailet log is
"Retrieving subscription...".
public void service (org.apache.mailet.Mail oMail) throws
javax.mail.MessagingException
{
this.log("Received message on server with "+ oMail.getRecipients
().size () +" recipients");
// get receipients
java.util.Collection oCollection = oMail.getRecipients();
log("Collection: " + oCollection.toString ());
java.util.Iterator oMailIterator = oCollection.iterator ();
while(oMailIterator.hasNext())
{
org.apache.mailet.MailAddress oMailAddress =
(org.apache.mailet.MailAddress) oMailIterator.next();
// check database
this.log("Checking if user \"" + oMailAddress.getUser () +"\"
is registered");
try
{
this.log("Retrieving subscription...");
String oHostString =
oJDBCSubscription.checkSubscription (oMailAddress.getUser ());
this.log("... retrieved: " + oHostString);
if(oHostString != null)
{
this.log("Found Registration, sending
notification");
// if user subscribed, send notification
com.globalatn.sl.ai.Notify oNotify = new
com.globalatn.sl.ai.Notify ();
oNotify.setDate(new java.util.Date());
oNotify.setServer
(java.net.InetAddress.getLocalHost ().getHostAddress ());
java.net.InetAddress oInetAddress =
java.net.InetAddress.getByName (oHostString);
this.oPacketServer.sendObject (oNotify,
oInetAddress);
}
else
{
this.log("No registration found");
}
}
catch (com.globalatn.dd.ps.PersistentStorageException
oPersistentStorageException)
{
this.log("DOH!: "+
oPersistentStorageException.toString () );
}
catch (java.net.UnknownHostException oUnknownHostException)
{
this.log("DOH!!: "+ oUnknownHostException.toString ());
}
catch (java.io.IOException oIOException)
{
this.log("DOH!!!: "+ oIOException.toString ());
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]