2 Replies Latest reply on Nov 8, 2010 1:01 AM by stan xi

    Seam 2.1.1GA + MessageDriven bean

    Giovanni Miano Newbie

      I am trying to create a test message driven bean to fetch mail from a pop3 mailbox, It does read the mailbox then delete the unread message but it does not call the method onMessage(Message arg0).


      Here my bean:


      @MessageDriven(activationConfig={
         @ActivationConfigProperty(propertyName="mailServer", propertyValue="smtp.host.com"),
         @ActivationConfigProperty(propertyName="mailFolder", propertyValue="INBOX"),
         @ActivationConfigProperty(propertyName="storeProtocol", propertyValue="pop3"),
         @ActivationConfigProperty(propertyName="userName", propertyValue="test@host.com"),
         @ActivationConfigProperty(propertyName="password", propertyValue="password"),
         @ActivationConfigProperty(propertyName="debug", propertyValue="true")
      })
      @ResourceAdapter("mail-ra.rar")
      @Name("mailListener")
      public class EJB3TestJavaMailMDB implements MailListener
      {
         private static Logger log = Logger.getLogger(EJB3TestJavaMailMDB.class);
      
      
         public void onMessage(Message arg0)
         {
              try {
            log.info(">>>> onMessage msg= "+arg0.getSubject());
              } catch (MessagingException e) {
                   e.printStackTrace();
                  }
         }
         
      }



      I get the following output (It clearly fetch the message but does not call the onMessage() method):


      17:07:25,831 INFO  [STDOUT] DEBUG: JavaMail version 1.4ea
      17:07:25,831 INFO  [STDOUT] DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre6\lib\javamail.providers (The system cannot find the file specified)
      17:07:25,847 INFO  [STDOUT] DEBUG: !anyLoaded
      17:07:25,847 INFO  [STDOUT] DEBUG: not loading resource: /META-INF/javamail.providers
      17:07:25,847 INFO  [STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
      17:07:25,847 INFO  [STDOUT] DEBUG: Tables of loaded providers
      17:07:25,847 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]}
      17:07:25,847 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]}
      17:07:25,847 INFO  [STDOUT] DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
      17:07:25,847 INFO  [STDOUT] DEBUG: !anyLoaded
      17:07:25,847 INFO  [STDOUT] DEBUG: not loading resource: /META-INF/javamail.address.map
      17:07:25,847 INFO  [STDOUT] DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre6\lib\javamail.address.map (The system cannot find the file specified)
      17:07:25,847 INFO  [STDOUT] DEBUG: setDebug: JavaMail version 1.4ea
      17:07:25,847 INFO  [STDOUT] DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
      17:07:25,847 INFO  [STDOUT] DEBUG POP3: connecting to host "smtp.host.com", port 110, isSSL false
      17:07:25,878 INFO  [STDOUT] S: +OK smtp.host.com Zimbra POP3 server ready
      17:07:25,878 INFO  [STDOUT] C: USER test@host.com
      17:07:25,878 INFO  [STDOUT] S: +OK hello test@host.com, please enter your password
      17:07:25,878 INFO  [STDOUT] C: PASS password
      17:07:25,894 INFO  [STDOUT] S: +OK server ready
      17:07:25,894 INFO  [STDOUT] C: STAT
      17:07:25,894 INFO  [STDOUT] S: +OK 1 1532
      17:07:25,894 INFO  [STDOUT] C: NOOP
      17:07:25,909 INFO  [STDOUT] S: +OK yawn
      17:07:25,909 INFO  [STDOUT] C: NOOP
      17:07:25,925 INFO  [STDOUT] S: +OK yawn
      17:07:25,925 INFO  [STDOUT] C: DELE 1
      17:07:25,941 INFO  [STDOUT] S: +OK message 1 marked for deletion
      17:07:25,941 INFO  [STDOUT] C: QUIT
      17:07:26,066 INFO  [STDOUT] S: +OK deleted 1 message(s)
      17:07:26,066 INFO  [STDOUT] DEBUG POP3: connecting to host "smtp.host.com", port 110, isSSL false
      17:07:26,081 INFO  [STDOUT] S: +OK smtp.host.com Zimbra POP3 server ready
      17:07:26,081 INFO  [STDOUT] C: USER test@host.com
      17:07:26,081 INFO  [STDOUT] S: +OK hello test@host.com, please enter your password
      17:07:26,081 INFO  [STDOUT] C: PASS password
      17:07:26,097 INFO  [STDOUT] S: +OK server ready
      17:07:26,097 INFO  [STDOUT] C: QUIT
      17:07:26,112 INFO  [STDOUT] S: +OK smtp.host.com closing connection




      Anyone any idea ?
      It is driving me mad!