9 Replies Latest reply on Aug 4, 2008 1:51 AM by Tony Herstell

    Email Failing? how get more logging (FAQ question)?

    Tony Herstell Master

      With Seam mail has anyone seen this?



      00:05:46,906 INFO  [MailSession] Creating JavaMail Session (smtp.gmail.com:465)
      00:05:46,953 INFO  [MailSession] connected to mail server
      00:06:58,750 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id -3f57fe38:b7d:48905782:8b invoked while multiple threads active within it.
      00:06:58,750 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action -3f57fe38:b7d:48905782:8b aborting with 1 threads active!



      I dont think things are going to plan...


      How do I log whats going on inside this:


      renderer.render("/WEB-INF/pages/mailingList/emailWrapper.xhtml");



      to try to figure out whats going wrong (or right for that matter)?

        • 1. Re: Email Failing? how get more logging (FAQ question)?
          Tony Herstell Master

          And then it finally bombed...


          It was only 250 mail messages....


          00:18:18,125 INFO  [Manager] destroying conversation with garbage lock: 7
          00:18:18,140 WARN  [Component] Exception calling component @Destroy method: mailingListController
          javax.ejb.NoSuchEJBException: Could not find stateful bean: 5c4o15k-dm77xk-fj9vx7lk-1-fj9w0890-s
               at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:390)
               at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:375)
               at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:61)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:97)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
               at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:204)
               at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
               at $Proxy129.destroy(Unknown Source)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
               at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
               at org.javassist.tmp.java.lang.Object_$$_javassist_9.destroy(Object_$$_javassist_9.java)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
               at org.jboss.seam.Component.callComponentMethod(Component.java:2092)
               at org.jboss.seam.Component.callDestroyMethod(Component.java:2023)
               at org.jboss.seam.Component.destroy(Component.java:1334)
               at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:251)
               at org.jboss.seam.contexts.Contexts.destroyConversationContext(Contexts.java:413)
               at org.jboss.seam.contexts.Lifecycle.destroyConversationContext(Lifecycle.java:157)
               at org.jboss.seam.core.Manager.destroyConversation(Manager.java:319)
               at org.jboss.seam.core.Manager.conversationTimeout(Manager.java:303)
               at org.jboss.seam.core.Manager.endRequest(Manager.java:353)
               at org.jboss.seam.jsf.SeamPhaseListener.afterRenderResponse(SeamPhaseListener.java:512)
               at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:245)
               at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
               at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
               at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
               at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
               at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
               at java.lang.Thread.run(Thread.java:619)

          • 2. Re: Email Failing? how get more logging (FAQ question)?
            Tony Herstell Master
                 @TransactionAttribute(TransactionAttributeType.REQUIRED)
                 @End
                 public String sendToMailingList() {
                      try {
                           recipients = new ArrayList<User>();
                           
                           // Add Registered users if they have said email contact is ok.
                           List<User> registeredUsers = (List<User>) em.createQuery("from User u where u.emailContactOk = :emailContactOk").setParameter("emailContactOk",true).getResultList();
                           for (User eachRegisteredUser : registeredUsers) {
                                if (eachRegisteredUser.isEmailContactOk()) {
                                     recipients.add(eachRegisteredUser);
                                }
                           }
            
                          // Set up mailing list users
                           List<MailingListEntry> mailingListEntries = (List<MailingListEntry>)em.createQuery ("from MailingListEntry").getResultList();
                           for (MailingListEntry eachMailingListEntry : mailingListEntries) {
                                boolean emailAlreadyInList = false;
                                for (User eachRecipient : recipients) {
                                     if ((eachMailingListEntry.getEmail().trim()).equalsIgnoreCase((eachRecipient.getEmail().trim()))) {
                                          emailAlreadyInList = true;
                                     }
                                }
                                if (!emailAlreadyInList) {
                                     User user = new User();
                                     user.setEmail(eachMailingListEntry.getEmail());
                                    recipients.add(user);
                                }
                           }
                          Contexts.getEventContext().set("recipients", recipients);
            
                          // Send the email.
                          renderer.render("/WEB-INF/pages/mailingList/emailWrapper.xhtml");
            
                          facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO,"mailing_list_emailed_successfully");
                          log.info("Mailing List Email(s) sent!");
                     } catch (Exception e) {
                          log.info("Mailing List Email(s) sending failed: "+e);
                     }
                     return "success";
                }

            • 3. Re: Email Failing? how get more logging (FAQ question)?
              Tony Herstell Master

              ran again and got this




              00:33:17,984 INFO  [STDOUT] Hibernate: select user0_.id as id5_, user0_.version4OptLock as version2_5_, user0_.password as password5_, user0_.email as email5_, user0_.emailContactOk as emailCon5_5_, user0_.avatar_id as avatar23_5_, user0_.firstname as firstname5_, user0_.surname as surname5_, user0_.homePhone as homePhone5_, user0_.mobilePhone as mobilePh9_5_, user0_.phoneContactOk as phoneCo10_5_, user0_.dressageJudge as dressag11_5_, user0_.dressageWriter as dressag12_5_, user0_.dressageHelper as dressag13_5_, user0_.sjJudge as sjJudge5_, user0_.sjHelper as sjHelper5_, user0_.showingJudge as showing16_5_, user0_.showingHelper as showing17_5_, user0_.eventsHelper as eventsH18_5_, user0_.termsApproved as termsAp19_5_, user0_.creationDate as creatio20_5_, user0_.dateEffectiveFrom as dateEff21_5_, user0_.dateEffectiveTo as dateEff22_5_ from User user0_ where user0_.emailContactOk=?
              00:33:21,250 INFO  [STDOUT] Hibernate: select mailinglis0_.id as id1_, mailinglis0_.version4OptLock as version2_1_, mailinglis0_.email as email1_, mailinglis0_.validated as validated1_ from MailingListEntry mailinglis0_
              00:35:46,484 INFO  [STDOUT] Hibernate: select image0_.id as id0_0_, image0_.name as name0_0_, image0_.type as type0_0_, image0_.version4OptLock as version4_0_0_, image0_.image as image0_0_ from Image image0_ where image0_.id=?
              00:36:51,968 INFO  [STDOUT] Hibernate: select image0_.id as id0_0_, image0_.name as name0_0_, image0_.type as type0_0_, image0_.version4OptLock as version4_0_0_, image0_.image as image0_0_ from Image image0_ where image0_.id=?
              00:38:58,765 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id -3f57fe38:b7d:48905782:fb invoked while multiple threads active within it.
              00:38:58,765 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action -3f57fe38:b7d:48905782:fb aborting with 1 threads active!
              


              • 4. Re: Email Failing? how get more logging (FAQ question)?
                Tony Herstell Master
                <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <ui:repeat value="#{recipients}" var="eachRecipient" xmlns="http://www.w3.org/1999/xhtml"
                     xmlns:m="http://jboss.com/products/seam/mail" xmlns:h="http://java.sun.com/jsf/html"
                     xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets">
                     <m:message>
                
                          <m:from name="Selwyn Equestrian Centre" address="tony.herstell@selwynequestriancentre.co.nz" />
                
                          <s:fragment rendered="#{(eachRecipient.firstname ne null)}">
                               <m:to name="#{eachRecipient.firstname} #{eachRecipient.surname}">#{eachRecipient.email}</m:to>
                          </s:fragment>
                          
                          <s:fragment rendered="#{(eachRecipient.firstname eq null)}">
                               <m:to>#{eachRecipient.email}</m:to>
                          </s:fragment>
                
                          <m:replyTo name="Selwyn Equestrian Centre" address="tony.herstell@selwynequestriancentre.co.nz" />
                
                          <m:subject>#{subjectText}</m:subject>
                
                          <m:body>
                               <table>
                                    <tr>
                                         <s:fragment rendered="#{!(eachRecipient.firstname eq null) or (eachRecipient.firstname eq '')}">
                                              <td width="50%" align="left">
                                                   <h:outputText value="Dear #{eachRecipient.firstname}" />
                                              </td>
                                         </s:fragment>
                                         <s:fragment rendered="#{eachRecipient.avatar ne null}">
                                              <td width="50%" align="center">
                                                   <m:attachment rendered="#{eachRecipient.avatar ne null}" value="#{eachRecipient.avatar.image}"
                                                        fileName="#{eachRecipient.avatar.name}" contentType="#{eachRecipient.avatar.type}"
                                                        status="avatar"
                                                        disposition="inline" />
                                                   <img src="cid:#{avatar.contentId}" />
                                              </td>
                                         </s:fragment>
                                    </tr>
                               </table>
                               
                               <p>
                                    <s:formattedText value="#{messageText}"/>
                               </p>
                
                               <p>
                                    <h:outputText value="#{messages.email_sec}" />
                               </p>
                
                               <center>
                
                                    <hr/>
                                              
                                    <p>
                                         <img src="#{basePath}/images/sec_logo_sm.gif" />
                                    </p>
                     
                                    <p>
                                         <h:outputText value="#{messages.email_website_sec}" />
                                    </p>
                
                               </center>
                
                
                          </m:body>
                     </m:message>
                </ui:repeat>
                

                • 5. Re: Email Failing? how get more logging (FAQ question)?
                  Alexander Torstling Newbie

                  Abort of action means that your transaction timeout kicks in. That seems to be a reasonable reason to not being able to call @Destroy. Try with @TransactionTimeout adjustment. Is every mail heavy to parse? I'm asking because the number of mails should not matter wrt transaction timeout (each mail parse should run in own tx).

                  • 6. Re: Email Failing? how get more logging (FAQ question)?
                    Tony Herstell Master

                    Thanks for you support.


                    The payload is trivial (it was more of a test message to see if it worked; and it didn't at all on the Server Ubuntu box (not even started to look at yet) and failed as above on my Windoze development box!)


                    The timeout happened only after things ground to a halt.


                    I am using 4.2.1.GA is this likely to cause a problem?


                    How do I debug this? How do I get information on whats going on?

                    • 7. Re: Email Failing? how get more logging (FAQ question)?
                      Tony Herstell Master

                      Dont code a 2am unless you are Pete or Gavin



                      List<User> registeredUsers = (List<User>) em.createQuery("from User u where u.emailContactOk \= :emailContactOk").setParameter("emailContactOk",true).getResultList();
                                     for (User eachRegisteredUser : registeredUsers) {
                                          if (eachRegisteredUser.isEmailContactOk()) {
                                               recipients.add(eachRegisteredUser);
                                          }
                                     }





                      Tony you muppet you just filtered if (eachRegisteredUser.isEmailContactOk() in the query



                      for (User eachRecipient : recipients) {
                                               if ((eachMailingListEntry.getEmail().trim()).equalsIgnoreCase((eachRecipient.getEmail().trim()))) {
                                                    emailAlreadyInList = true;
                                               }
                                          }



                      Should break out of loop

                      • 8. Re: Email Failing? how get more logging (FAQ question)?
                        Tony Herstell Master

                        On my seconds day and the server still wont send emails (it used to)



                        This is what I get when sent from dev machine


                        23:49:47,968 INFO  [MailSession] Creating JavaMail Session (smtp.gmail.com:465)
                        23:49:47,984 INFO  [MailSession] connected to mail server
                        23:49:53,640 INFO  [MailingListControllerImpl] Mailing List Email(s) sent!
                        



                        This from the server



                        2008-07-31 23:16:15,207 INFO  [nz.co.selwynequestriancentre.action.mailingList.MailingListControllerImpl] Mailing List Email(s) sending failed: javax.faces.FacesException: Unknown SMTP host: smtp.gmail.com





                        I don't run any ant/maven script to create/alter the .EAR to be uploaded so it's the same code!


                        This is from components.xml


                             <mail:mail-session host="smtp.gmail.com"
                                  username="tony.herstell@selwynequestriancentre.co.nz"
                                  password="you-wish" ssl="true" port="465" />
                        



                        Why would the email fail for Ubuntu and work on Windoze?


                        Any ideas?


                        • 9. Re: Email Failing? how get more logging (FAQ question)?
                          Tony Herstell Master

                          Found nslookup didnt work on my Server.


                          Email ISP and was told oops that DNS crapped out a whie ago... forgot about your little old machine.
                          So fixing the DNS (/etc/resolve.conf) cured the talking to gmail.


                          Still get errors about transactions failing (with 250 mail messages in a ui:repeat) but the messages still seem to go out.


                          So; will try extending the transaction timeout (as advised above) and may even add @Transaction notrequired! as I don't actually change the Dbase at all; so don't even need a transaction.


                          Thx guys.