onMessage method not called with MailListener MDB
wiberto Jul 22, 2007 7:57 PMI have a MailListener MDB that is not being called. It looks like everything is setup fine because I can see in the debug log that the email is being retrieved and deleted, but my method is never called.
Here's the class:
import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.mail.Message; import org.jboss.annotation.ejb.ResourceAdapter; import org.jboss.resource.adapter.mail.inflow.MailListener; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Logger; import org.jboss.seam.annotations.Name; import org.jboss.seam.log.Log; @MessageDriven(activationConfig={ @ActivationConfigProperty(propertyName="mailServer", propertyValue="host"), @ActivationConfigProperty(propertyName="userName", propertyValue="user"), @ActivationConfigProperty(propertyName="password", propertyValue="pass"), @ActivationConfigProperty(propertyName="storeProtocol", propertyValue="pop3"), @ActivationConfigProperty(propertyName = "mailFolder", propertyValue = "INBOX"), @ActivationConfigProperty(propertyName = "debug", propertyValue = "true"), @ActivationConfigProperty(propertyName = "flush", propertyValue = "true") }) @ResourceAdapter("mail-ra.rar") @Name("emailRetrieverMDB") public class EmailRetrieverMDB implements MailListener { @In(create=true) private OrderEmailProcessor orderEmailProcessor; @Logger private Log log; public void onMessage(Message message) { // Process the message log.info("onMessage being called", (Object[])null); System.out.println("on Message"); orderEmailProcessor.process(message); } }
Here's what I have in my components.xml:
<mail:mail-session session-jndi-name="java:/Mail"> </mail:mail-session>
And here's the log output:
18:53:57,654 INFO [STDOUT] DEBUG: JavaMail version 1.4ea 18:53:57,659 INFO [STDOUT] DEBUG: java.io.FileNotFoundException: C:\dev\jdk1.6.0\jre\lib\javamail.providers (The system cannot find the file specified) 18:53:57,662 INFO [STDOUT] DEBUG: !anyLoaded 18:53:57,662 INFO [STDOUT] DEBUG: not loading resource: /META-INF/javamail.providers 18:53:57,664 INFO [STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.providers 18:53:57,664 INFO [STDOUT] DEBUG: Tables of loaded providers 18:53:57,664 INFO [STDOUT] DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]} 18:53:57,665 INFO [STDOUT] DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]} 18:53:57,665 INFO [STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map 18:53:57,667 INFO [STDOUT] DEBUG: !anyLoaded 18:53:57,667 INFO [STDOUT] DEBUG: not loading resource: /META-INF/javamail.address.map 18:53:57,667 INFO [STDOUT] DEBUG: java.io.FileNotFoundException: C:\dev\jdk1.6.0\jre\lib\javamail.address.map (The system cannot find the file specified) 18:53:57,667 INFO [STDOUT] DEBUG: setDebug: JavaMail version 1.4ea 18:53:57,667 INFO [STDOUT] DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc] 18:53:57,668 INFO [STDOUT] DEBUG POP3: connecting to host "host", port 110, isSSL false 18:53:57,831 INFO [STDOUT] S: +OK Welcome to MailEnable POP3 Server 18:53:57,831 INFO [STDOUT] C: USER user 18:53:57,899 INFO [STDOUT] S: +OK 18:53:57,899 INFO [STDOUT] C: PASS pass 18:53:57,967 INFO [STDOUT] S: +OK 18:53:57,968 INFO [STDOUT] C: STAT 18:53:58,033 INFO [STDOUT] S: +OK 0 0 18:53:58,033 INFO [STDOUT] C: NOOP 18:53:58,100 INFO [STDOUT] S: +OK 18:53:58,100 INFO [STDOUT] C: NOOP 18:53:58,166 INFO [STDOUT] S: +OK 18:53:58,166 INFO [STDOUT] C: QUIT 18:53:58,233 INFO [STDOUT] S: +OK Goodbye 18:53:58,233 INFO [STDOUT] DEBUG POP3: connecting to host "host", port 110, isSSL false 18:53:58,375 INFO [STDOUT] S: +OK Welcome to MailEnable POP3 Server 18:53:58,375 INFO [STDOUT] C: USER user 18:53:58,441 INFO [STDOUT] S: +OK 18:53:58,441 INFO [STDOUT] C: PASS pass 18:53:58,510 INFO [STDOUT] S: +OK 18:53:58,510 INFO [STDOUT] C: QUIT 18:53:58,576 INFO [STDOUT] S: +OK Goodbye
I'm using Seam 1.2.1 and I copied the mail-ra.rar to my jboss 4.2.0 deployment. The mail-service.xml is empty. As I wanted to make sure that something outside my project wasn't intercepting the message, but it's not.
Anything obvious I'm missing?
Thanks,
Jose