3 Replies Latest reply on May 6, 2008 3:27 PM by Jorge Ramirez

    JBPM sending mail

    Rajesh Choudhari Newbie

      I am not able to send mail from the JBPM. Can somebody please help, details mentioned below:-

      Following are my entries in the processdefinition.xml:-



      Test Mail from JBOSS JBPM
      This is a Mail from JBOSS JBPM sent by Rajesh Choudhari
      rajesh_choudhari@persistent.co.in




      Following is the entry in my jbpm.cfg.xml:-


      Following is the code in MyMailAction:-
      public void execute(ExecutionContext executionContext){
      // TODO Auto-generated method stub
      //executionContext.getContextInstance().;
      Properties mailProps = new Properties();
      mailProps.put("jbpm.mail.smtp.host", "10.77.225.254");
      mailProps.put("port","25");
      Mail.send(mailProps, this.getFromAddress(), this.getRecipients(), this.getSubject(), this.getText());

      Following is the error:-
      11:13:50,344 [main] ERROR GraphElement : action threw exception: couldn't send email
      org.jbpm.JbpmException: couldn't send email
      at org.jbpm.mail.Mail.send(Mail.java:142)
      at com.jbay.action.MyMailAction.execute(MyMailAction.java:23)
      at org.jbpm.graph.def.Action.execute(Action.java:122)
      at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:247)
      at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:215)
      at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:185)
      at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:169)
      at org.jbpm.graph.exe.Token.signal(Token.java:191)
      at org.jbpm.graph.exe.Token.signal(Token.java:139)
      at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:251)
      at com.jbay.HelloTest.testActionHandler(HelloTest.java:59)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: javax.mail.SendFailedException: Sending failed;
      nested exception is:
      class javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
      nested exception is:
      java.net.ConnectException: Connection refused: connect
      at javax.mail.Transport.send0(Transport.java:218)
      at javax.mail.Transport.send(Transport.java:80)
      at org.jbpm.mail.Mail.send(Mail.java:140)
      ... 26 more

        • 1. Re: JBPM sending mail
          Rajesh Choudhari Newbie

           

          "racbsl" wrote:
          I am not able to send mail from the JBPM. Can somebody please help, details mentioned below:-

          Following are my entries in the processdefinition.xml:-
          < state name="auction" >
          < event type="before-signal" >
          < action name="SendMail" class="com.jbay.action.MyMailAction" >
          < subject >Test Mail from JBOSS JBPM < / subject >
          < text >This is a Mail from JBOSS JBPM sent by Rajesh Choudhari< / text >
          < to >rajesh_choudhari@persistent.co.in< /to>
          < / action >
          < / event >
          < transition name="to_end" to="end1" >< / transition >
          < / state >
          Following is the entry in my jbpm.cfg.xml:-
          < string name="jbpm.mail.smtp.host" value="localhost" />
          < string name='mail.class.name' value='com.jbay.actio.MyMailAction' / >
          Following is the code in MyMailAction:-
          public void execute(ExecutionContext executionContext){
          // TODO Auto-generated method stub
          //executionContext.getContextInstance().;
          Properties mailProps = new Properties();
          mailProps.put("jbpm.mail.smtp.host", "10.77.225.254");
          mailProps.put("port","25");
          Mail.send(mailProps, this.getFromAddress(), this.getRecipients(), this.getSubject(), this.getText());

          Following is the error:-
          11:13:50,344 [main] ERROR GraphElement : action threw exception: couldn't send email
          org.jbpm.JbpmException: couldn't send email
          at org.jbpm.mail.Mail.send(Mail.java:142)
          at com.jbay.action.MyMailAction.execute(MyMailAction.java:23)
          at org.jbpm.graph.def.Action.execute(Action.java:122)
          at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:247)
          at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:215)
          at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:185)
          at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:169)
          at org.jbpm.graph.exe.Token.signal(Token.java:191)
          at org.jbpm.graph.exe.Token.signal(Token.java:139)
          at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:251)
          at com.jbay.HelloTest.testActionHandler(HelloTest.java:59)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at junit.framework.TestCase.runTest(TestCase.java:154)
          at junit.framework.TestCase.runBare(TestCase.java:127)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
          Caused by: javax.mail.SendFailedException: Sending failed;
          nested exception is:
          class javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
          nested exception is:
          java.net.ConnectException: Connection refused: connect
          at javax.mail.Transport.send0(Transport.java:218)
          at javax.mail.Transport.send(Transport.java:80)
          at org.jbpm.mail.Mail.send(Mail.java:140)
          ... 26 more



          • 2. Re: JBPM sending mail
            Rajesh Choudhari Newbie

            The Problem has been resolved. I configured a local host SMTP server from Apache James and it did work.

            Thanks.

            • 3. Re: JBPM sending mail
              Jorge Ramirez Newbie

              Where and how you define the following methods:


              FromAddress(), getRecipients(), getSubject(), getText());



              Thank's