6 Replies Latest reply on Sep 2, 2008 12:23 AM by sagyer

    Error while attempting to send mail

    sagyer

      Hello,

      I am trying to send a mail from my jbpm workflow using the mail-node.

      Here is my processdefinition.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="SendMail">
      
       <start-state name="start-state1">
       <transition to="mail-node1"></transition>
       </start-state>
      
       <mail-node name="mail-node1" to="sagar.yerunkar@lntinfotech.com">
       <subject>TestJBPM</subject>
       <text>Sent using a mail node.</text>
       <transition to="end-state1"></transition>
       </mail-node>
      
       <end-state name="end-state1"></end-state>
      
      </process-definition>
      


      I have added the element :
      <string name="mail.smtp.host" value="172.25.8.13" />
      

      to config/jbpm.cfg.xml

      I get the error below :
      2008-08-28 15:01:57,649 DEBUG [org.hibernate.loader.Loader] done entity load
      2008-08-28 15:01:57,728 DEBUG [org.jbpm.mail.Mail] sending email to '[sagar.yerunkar@lntinfotech.com]' about '
       TestJBPM
       '
      2008-08-28 15:01:58,993 ERROR [org.jbpm.graph.def.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 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:585)
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
       at org.jbpm.graph.def.Action_$$_javassist_63.execute(Action_$$_javassist_63.java)
       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 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:585)
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
       at org.jbpm.graph.def.Node_$$_javassist_49.enter(Node_$$_javassist_49.java)
       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 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:585)
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
       at org.jbpm.graph.def.Node_$$_javassist_49.leave(Node_$$_javassist_49.java)
       at org.jbpm.graph.exe.Token.signal(Token.java:195)
       at org.jbpm.graph.exe.Token.signal(Token.java:140)
       at org.jbpm.jsf.core.action.SignalActionListener.handleAction(SignalActionListener.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:746)
       at javax.faces.component.UICommand.broadcast(UICommand.java:368)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
       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:251)
       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:290)
       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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
       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:595)
      Caused by: javax.mail.MessagingException: Exception reading response;
       nested exception is:
       java.net.SocketException: Connection reset
       at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1611)
       at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369)
       at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
       at javax.mail.Service.connect(Service.java:288)
       at javax.mail.Service.connect(Service.java:169)
       at javax.mail.Service.connect(Service.java:118)
       at javax.mail.Transport.send0(Transport.java:188)
       at javax.mail.Transport.send(Transport.java:118)
       at org.jbpm.mail.Mail.send(Mail.java:150)
       ... 59 more
      Caused by: java.net.SocketException: Connection reset
       at java.net.SocketInputStream.read(SocketInputStream.java:168)
       at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
       at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
       at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
       at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88)
       at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589)
       ... 67 more
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.cache.NonstrictReadWriteCache] Cache lookup: org.jbpm.graph.def.Node.exceptionHandlers#11
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.cache.NonstrictReadWriteCache] Cache miss
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.loader.Loader] loading collection: [org.jbpm.graph.def.Node.exceptionHandlers#11]
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.SQL] select exceptionh0_.NODE_ as NODE7_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_9_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_9_0_, exceptionh0_.TYPE_ as TYPE3_9_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_9_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.NODE_=?
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.loader.Loader] result set contains (possibly empty) collection: [org.jbpm.graph.def.Node.exceptionHandlers#11]
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.engine.loading.CollectionLoadContext] 1 collections were found in result set for role: org.jbpm.graph.def.Node.exceptionHandlers
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.engine.loading.CollectionLoadContext] Caching collection: [org.jbpm.graph.def.Node.exceptionHandlers#11]
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.cache.NonstrictReadWriteCache] Caching: org.jbpm.graph.def.Node.exceptionHandlers#11
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.engine.loading.CollectionLoadContext] collection fully initialized: [org.jbpm.graph.def.Node.exceptionHandlers#11]
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.engine.loading.CollectionLoadContext] 1 collections initialized for role: org.jbpm.graph.def.Node.exceptionHandlers
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.loader.Loader] done loading collection
      2008-08-28 15:01:58,993 DEBUG [org.jbpm.JbpmContext] closing jbpmContext org.jbpm.JbpmContext@e4436
      2008-08-28 15:01:58,993 DEBUG [org.jbpm.svc.Services] executing default save operations
      2008-08-28 15:01:58,993 DEBUG [org.jbpm.svc.save.HibernateSaveOperation] saving process instance
      2008-08-28 15:01:58,993 DEBUG [org.jbpm.svc.save.SaveLogsOperation] flushing logs to logging service.
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] executing identity-insert immediately
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.SQL] insert into JBPM_LOG (ID_, INDEX_, DATE_, TOKEN_, PARENT_, TRANSITION_, CLASS_) values (null, ?, ?, ?, ?, ?, 'S')
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
      2008-08-28 15:01:58,993 DEBUG [org.hibernate.SQL] call identity()
      


      I also tried changing src/jpdl/org/jbpm/default.jbpm.cfg.xml as well to modify the relevant element to
      <string name="mail.smtp.host" value="172.25.8.13" />


      I have tried sending a mail using java code using this smtp address. It works.

      I am using jBPM version 3.2.2

      Kindly help.

      Sagar

        • 1. Re: Error while attempting to send mail
          sagyer

          A little clarification :


          I also tried changing src/jpdl/org/jbpm/default.jbpm.cfg.xml as well to modify the relevant element to
          <string name="mail.smtp.host" value="172.25.8.13" />
          



          The above change doesn't help; I get the same error as in the above post.



          • 2. Re: Error while attempting to send mail
            kukeltje

            seems to have nothing to do with jBPM. Can you send email from java at all?

            • 3. Re: Error while attempting to send mail
              sagyer

               

              "kukeltje" wrote:
              seems to have nothing to do with jBPM. Can you send email from java at all?


              Yes, I can send mail from java from the same machine. Here is the code that sends the mail. I have tested this code and it works :

               public static void main(String[] args) throws AddressException,
               MessagingException {
              
               String smtpHost = "172.25.8.13";
              
               String from = "sagar.yerunkar@lntinfotech.com";
               String to = "sagar.yerunkar@lntinfotech.com";
               String cc = "sagyer@gmail.com";
               String bcc = "";
               String message = "Test Mail";
               String subject = "Test Subject";
              
               Properties props = new Properties();
               props.put("mail.smtp.host", smtpHost);
               Session session = Session.getInstance(props);
              
               // Instantiate a message
               Message msg = new MimeMessage(session);
              
               // Set message attributes
               msg.setFrom(new InternetAddress(from));
               InternetAddress[] address = { new InternetAddress(to) };
              
               msg.setRecipients(Message.RecipientType.TO, address);
               if (!("".equals(cc))) {
               InternetAddress[] addresscc = { new InternetAddress(cc) };
               msg.setRecipients(Message.RecipientType.CC, addresscc);
               }
               if (!("".equals(bcc))) {
               InternetAddress[] addressbcc = { new InternetAddress(bcc) };
               msg.setRecipients(Message.RecipientType.BCC, addressbcc);
               }
               msg.setSubject(subject);
               msg.setSentDate(new Date());
              
               // Set message content
               msg.setText(message);
               // ////////////////////////////////////////
              
               // Send the message
               Transport.send(msg);
              
               System.out.println("Sent mail successfully");
              
               }
              
              


              • 4. Re: Error while attempting to send mail
                kukeltje

                afaik jBPM does the same, so no idea why there is a connection reset. Does your mailserver log anything?

                • 5. Re: Error while attempting to send mail
                  kukeltje

                  oh and is the sending from java from the same machine as where jBPM runs on?

                  • 6. Re: Error while attempting to send mail
                    sagyer

                    Yes, the code is working from the same machine.