There are no restrictions accessing mysql or any DB.  My suspicion is  there
is a ClassNotFoundException for com.globalatn.* or a class this depends on,
being logged in some other James log.

best of luck

Lindsay

-----Original Message-----
From: Rene Lacasse [mailto:[EMAIL PROTECTED]
Sent: 17 October 2003 22:09
To: [EMAIL PROTECTED]
Subject: MySQL connection within a mailet


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]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to