6 Replies Latest reply on Jan 30, 2010 11:28 AM by sathish avunoori

    Receiving mail with Seam 2.1.1 and JBoss AS 5.0.0 bestpractices?

    wondersonic wondersonic Newbie

      Hi,
      do you have best practices for receiving e-mail in an enterprise application using Seam and deployed on JBoss AS 5.0.0?


      I found this interesting link but failed to deploy it (maybe deprecated?).


      TIA,
      WS

        • 1. Re: Receiving mail with Seam 2.1.1 and JBoss AS 5.0.0 bestpractices?
          wondersonic wondersonic Newbie

          EJB 3 message driven bean:



          import org.jboss.ejb3.annotation.ResourceAdapter;
          import org.jboss.resource.adapter.mail.inflow.MailListener;
          import org.jboss.seam.annotations.Name;
          
          import javax.ejb.ActivationConfigProperty;
          import javax.ejb.MessageDriven;
          import javax.mail.Message;
          
          /**
           * @see <a href="http://www.jboss.org/community/docs/DOC-10032">InboundJavaMail</a>
           */
          @MessageDriven(activationConfig = {
                  @ActivationConfigProperty(propertyName = "mailServer", propertyValue = "imap.gmail.com"),
                  @ActivationConfigProperty(propertyName = "mailFolder", propertyValue = "INBOX"),
                  @ActivationConfigProperty(propertyName = "storeProtocol", propertyValue = "imap"),
                  @ActivationConfigProperty(propertyName = "userName", propertyValue = "xxx@gmail.com"),
                  @ActivationConfigProperty(propertyName = "password", propertyValue = "xxx"),
                  @ActivationConfigProperty(propertyName = "port", propertyValue = "465"),
                  @ActivationConfigProperty(propertyName = "starttls", propertyValue = "true"),
                  @ActivationConfigProperty(propertyName = "debug", propertyValue = "true")
          })
          @ResourceAdapter("mail-ra.rar")
          @Name("mailListener")
          public class RegistrationMailListener implements MailListener {
              public void onMessage(Message message) {
                  // Process the message
                  System.out.println("Received message: "+message);
              }
          }



          in jboss5/server/default/deploy there is the original mail-ra.rar (from 5.0.0). Removing (or not) mail-service.xml still produce the following exception:


          Exception during deployment:



          20:24:19,000 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERR
          ORS FOR DETAILS):
          
          *** CONTEXTS IN ERROR: Name -> Error
          
          jboss.j2ee:ear=xxx.ear,jar=xxx.jar,name=RegistrationMailListener,service=EJB3 -> java.beans.IntrospectionExcep
          tion: No property found for: subscriptionDurability on JavaBean: MailActivationSpec(mailServer=mailhost, storeProtocol=p
          op3, mailFolder=INBOX, pollingInterval=60000, messageSelector=null, userName=xxx@gmail.com, maxMessages=1, debug=t
          rue, starttls=true, port=465)




          note: I tried without success replacing the 5.0.0 mail-ra.rar file with the one delivered into Seam 2.1.1 (which seems in fact to be the one from JBoss 5.0.0 beta 2 according to MANIFEST.MF).

          • 2. Re: Receiving mail with Seam 2.1.1 and JBoss AS 5.0.0 bestpractices?
            wondersonic wondersonic Newbie

            I wonder what is this subscriptionDurability property that does not exist at all in MailActivationSpec!


            Any idea?


            Environment:



            • Seam 2.1.1.GA

            • JBoss AS 5.0.0.GA

            • Sun JDK 1.6.0.11-b03

            • EAR build via Seam examples build scripts

            • everything else in my EAR works fine


            • 3. Re: Receiving mail with Seam 2.1.1 and JBoss AS 5.0.0 bestpractices?
              wondersonic wondersonic Newbie
              After surfing on different mailing-lists/forums, I found this:

              http://jira.jboss.org/jira/browse/JBMETA-169

              and this:

              http://www.jboss.com/index.html?module=bb&op=viewtopic&t=148386

              Maybe it's impacting also Mail example.
              • 4. Re: Receiving mail with Seam 2.1.1 and JBoss AS 5.0.0 bestpractices?
                wondersonic wondersonic Newbie

                Bad news:


                Upgrade jboss-metadata to 1.0.0.GA


                jboss-metadata will be updated in JBoss AS 5.1.0 only :(


                I think I'll forget about mail retrieval until this release...


                • 5. Re: Receiving mail with Seam 2.1.1 and JBoss AS 5.0.0 bestpractices?
                  sathish avunoori Newbie

                  hi ,
                  i am also configured mail-ra.rar in my MDB but am getting error like follows



                  15:45:54,728 ERROR [MailActivation] Failed to execute folder check, spec=MailActivationSpec(mailServer=pop.gmail.com, storeProtocol=pop3, mailFolder=INBOX, pollingInterval=70000, messageSelector=null, userName=XXX@gmail.com, maxMessages=1, debug=false)
                  


                  if you have solution ,then could you please advice me how can i rectify this error ?



                  advance thanks for your precious advise


                  sathish

                  • 6. Re: Receiving mail with Seam 2.1.1 and JBoss AS 5.0.0 bestpractices?
                    sathish avunoori Newbie

                    hi
                    i configured mail-ra.rar in my MDB with @ResourceAdaptor annotation.
                    like follows



                    @MessageDriven(activationConfig = {@ActivationConfigProperty(propertyName="mailServer", propertyValue="pop.gmail.com"),
                                 @ActivationConfigProperty(propertyName="mailFolder", propertyValue="INBOX"),
                                 @ActivationConfigProperty(propertyName="storeProtocol", propertyValue="pop3"),
                                 @ActivationConfigProperty(propertyName = "port", propertyValue = "995"),
                                 @ActivationConfigProperty(propertyName="pollingInterval", propertyValue="70000"),
                                 @ActivationConfigProperty(propertyName="userName", propertyValue="XXX@gmail.com"),
                                 @ActivationConfigProperty(propertyName="password", propertyValue="XXX"),
                                 @ActivationConfigProperty(propertyName = "flush", propertyValue = "false"),
                                   @ActivationConfigProperty(propertyName = "debug", propertyValue = "false")})
                    @ResourceAdapter("mail-ra.rar")
                    @Name("mailInbox")
                    public class MailInbox implements MailListener
                    {
                         public void onMessage(Message message)
                         {
                              System.out.println("mail received.....");
                               try {
                                    
                                    System.out.println("The msg has been recieveed #0"+message.getSubject());
                                    } catch (MessagingException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                    }
                         }
                         
                    
                    }
                    




                    i have replaced this folder in jboss AS's deploy folder.
                    is there any more configuration details for mail-ra.rar in our seam application?


                    Need help.
                    thanks in advance
                    sathish