11 Replies Latest reply on Sep 9, 2009 7:32 AM by Benito Juarez

    Mail Node

    Taj Newbie

      How does this email node work.

      Do we have to hardcode eveything into the xml? Cant we create the subject, mail content etc and then use it in the email node.

      Would be great if anyone can advise how the node works.

        • 1. Re: Mail Node
          Felipe Fornachari Newbie

          Yes, I have the same doubt.
          I know that I am asking too much, but I did understand how to configure JBoss jBPM to use the mail-node.
          I am trying to follow this guide http://docs.jboss.org/jbpm/v3/userguide/mail.html but It is a little confuse.

          Inside my jBPM project in eclipse there is a configuration file called jbpm.cfg.xml. By default it came empty. Inside the file there are only some informations, not very clear, about how customize the jbpm.cfg.xml's values.

          I configured the jbpm.cfg.xml file like below:

          <jbpm-configuration>
          
           <jbpm-context>
           <service name="persistence">
           <factory>
           <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
           <field name="isTransactionEnabled"><false/></field>
           </bean>
           </factory>
           </service>
           <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
           <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
           <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
           <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
           <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
           </jbpm-context>
          
           <string name="resource.hibernate.cfg.xml" value="jbpm.hibernate.cfg.xml" />
          
           <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
          
           <string name="jbpm.mail.templates" value="jbpm.mail.templates.xml" />
           <string name="resource.mail.properties" value="jbpm.mail.properties" />
          
           <string name="jbpm.mail.smtp.host" value="MySMTPServer" />
           <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
           <string name="jbpm.mail.from.address" value="wf@test.com" />
          
          </jbpm-configuration>
          


          Then I tried to send an email using a email-node. I filled the form "Mail Info" in eclipse, with the subject, "to" and the message, then I deployed my process and start it from the jBPM Adm Console. In my process there is a form with a "SEND" button, when I click in SEND, my process should go to the mail-node and send the email. But when I did that I received the error below in jBPM Adm Console:

          Error completing task: An exception of type "org.jbpm.JbpmException" was thrown. The message is: couldn't send email

          The complete error is below:

          12:02:49,539 WARN [ProxyWarnLog] Narrowing proxy to class org.jbpm.graph.node.StartState - this operation breaks ==
          12:02:49,555 ERROR [GraphElement] action threw exception: couldn't send email
          org.jbpm.JbpmException: couldn't send email
           at org.jbpm.mail.Mail.send(Mail.java:152)
           at org.jbpm.mail.Mail.send(Mail.java:116)
           at org.jbpm.mail.Mail.execute(Mail.java:63)
           at org.jbpm.graph.def.Action.execute(Action.java:122)
           at org.jbpm.graph.def.Action$$FastClassByCGLIB$$7876e90e.invoke(<generated>)
           at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
           at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163)
           at org.jbpm.graph.def.Action$$EnhancerByCGLIB$$9969df7d.execute(<generated>)
           at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:264)
           at org.jbpm.graph.node.MailNode.execute(MailNode.java:29)
           at org.jbpm.graph.def.Node.enter(Node.java:319)
           at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
           at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
           at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163)
           at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$9fffe621.enter(<generated>)
           at org.jbpm.graph.def.Transition.take(Transition.java:151)
           at org.jbpm.graph.def.Node.leave(Node.java:394)
           at org.jbpm.graph.node.StartState.leave(StartState.java:70)
           at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
           at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
           at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163)
           at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$9fffe621.leave(<generated>)
           at org.jbpm.graph.exe.Token.signal(Token.java:195)
           at org.jbpm.graph.exe.Token.signal(Token.java:166)
           at org.jbpm.graph.exe.Token$$FastClassByCGLIB$$74df1c6e.invoke(<generated>)
           at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
           at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163)
           at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$cf59539d.signal(<generated>)
           at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:488)
           at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:427)
           at org.jbpm.jsf.core.action.CompleteTaskActionListener.handleAction(CompleteTaskActionListener.java:52)
           at org.jbpm.jsf.core.impl.JbpmActionListenerWrapper.processAction(JbpmActionListenerWrapper.java:82)
           at javax.faces.event.ActionEvent.processListener(ActionEvent.java:77)
           at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:758)
           at javax.faces.component.UICommand.broadcast(UICommand.java:368)
           at org.jbpm.jsf.taskform.ui.UITaskFormButtonBase.broadcast(UITaskFormButtonBase.java:56)
           at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:448)
           at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Unknown Source)
          Caused by: javax.mail.SendFailedException: Sending failed;
           nested exception is:
           class javax.mail.SendFailedException: Invalid Addresses;
           nested exception is:
           class javax.mail.SendFailedException: 550 5.7.1 Unable to relay for MyName@MyCompany.com
          
           at javax.mail.Transport.send0(Transport.java:218)
           at javax.mail.Transport.send(Transport.java:80)
           at org.jbpm.mail.Mail.send(Mail.java:150)
           ... 60 more
          


          Probably I did not do the correct configurations to use email-node in jBPM.
          Any body could help me?
          Any help would be appreciated!

          Thanks very much!

          • 2. Re: Mail Node
            Felipe Fornachari Newbie

            I forgot to say, I am using JBoss jBPM 3.2.2.

            Thank you!

            • 3. Re: Mail Node
              Ananth Sreepathi Newbie

              FornChari:
              It looks like the address to whom you are sending is not in the mail server you are testing with and causing the exception. I suggest you try usign your own address resolver class which implements org.jbpm.mail.AddressResolver that will change the id of the actor as per your mailserver domain.

              • 4. Re: Mail Node
                Felipe Fornachari Newbie

                Sreepathia, thanks for your reply.

                I'm sure that the address that I am sending the email is in the mail server that I am using, because I use the specified smtp server in others applications (no jBPM applications) with the same email address that I am trying now.
                Would you think that is a configuration problem? Maybe with my jbpm.cfg.xml oy other thing that I didn't do?

                Thanks!

                • 5. Re: Mail Node
                  Ronald van Kuijk Master

                  TThis has nothing to do with jBPM. The error:

                  550 5.7.1 Unable to relay for MyName@MyCompany.com

                  Is from your mailserver. It just does not accept this adres.

                  • 6. Re: Mail Node
                    Felipe Fornachari Newbie

                    Kukeltje,

                    I did a program in Java, using the class javax.mail, and, using the code below, I can send email, using the same smtp server and the same email address that I tried in jBPM:

                    Properties p = new Properties();
                    p.put("mail.host", "MyServerSMTP");
                    Session session = Session.getInstance(p, null);
                    MimeMessage msg = new MimeMessage(session);
                    msg.setFrom(new InternetAddress("request.notify@workflowmachine.com"));
                    msg.setRecipient(Message.RecipientType.TO, new InternetAddress("myname@mycompany.com"));
                    msg.setSentDate(new Date());
                    msg.setSubject("Teste");
                    msg.setText("Email test!");
                    Transport.send(msg);


                    So, I suppose that my mailserver accepts the address that I using, doesn't it?

                    • 7. Re: Mail Node
                      Ananth Sreepathi Newbie

                       

                      class javax.mail.SendFailedException: Invalid Addresses;
                       nested exception is:
                       class javax.mail.SendFailedException: 550 5.7.1 Unable to relay for MyName@MyCompany.com
                      
                       at javax.mail.Transport.send0(Transport.java:218)


                      msg.setFrom(new InternetAddress("request.notify@workflowmachine.com"));
                      msg.setRecipient(Message.RecipientType.TO, new InternetAddress("myname@mycompany.com"));
                      

                      The address looks to have some caps charecters then the one you posted recently.try making this case sensitive,all lower case.

                      Thanks

                      • 8. Re: Mail Node
                        Felipe Fornachari Newbie

                        Thank you for your reply sreepathia,

                        When I writed "mycompany@mycompany" and "MyCompany@MyCompany" it was just to give an example, here I am using my real email "felipe.fornachari@........", so the problem is not my email address, probably is some configuration in the config XML.

                        But thank you..

                        If some one have I idea, please, let me know!



                        • 9. Re: Mail Node
                          Ronald van Kuijk Master

                          ALWAYS post what you realy use, not replacements... if in the test app you use felipe... then in the process also use felipe...

                          • 10. Re: Mail Node
                            Benito Juarez Newbie

                            i got the same problem. is there a solution for it?

                            • 11. Re: Mail Node
                              Benito Juarez Newbie

                              is it possible that jbpm version 3.2.2. doesnt support smtp authentification? I cant find any authentification code in the responsible class http://www.java2s.com/Open-Source/Java-Document/Workflow-Engines/jbpm-jpdl-3.2.2/org/jbpm/mail/Mail.java.htm.

                              Maybe thats the source of the mentioned problems.[/url]