[jboss-user] [JBoss jBPM] - Why doesn't work?

ricardomarques do-not-reply at jboss.com
Fri May 18 07:36:27 EDT 2007


Hi guys

I have the following process:


  | <process-definition
  |   xmlns="urn:jbpm.org:jpdl-3.1"  name="sendmail">
  |    <start-state name="Inicio">
  |       <transition name="" to="Send Mail"></transition>
  |    </start-state>
  |    <end-state name="Fim"></end-state>
  |    <node name="Send Mail">
  |   		<action class="test.MailMeActionHandler"></action>
  |       <transition name="" to="Fim"></transition>
  |    </node>
  | </process-definition>
  | 

And the following action handler:


  | package pep.test;
  | 
  | import org.jbpm.graph.def.ActionHandler;
  | import org.jbpm.graph.exe.ExecutionContext;
  | //import java.util.Properties;
  | //import javax.mail.*;
  | //import javax.mail.internet.*;
  | import java.io.*;
  | 
  | public class MailMeActionHandler implements ActionHandler {
  | 
  | 	private static final long serialVersionUID = 1L;
  | 	
  | 	public void execute(ExecutionContext context) throws Exception {
  | 		
  | 		
  | 		/* Tenta enviar o e-mail*/
  | 		
  | 	   String host = "smtp.myserver.com";
  | 	    String from = "ricardo.marques at myserver.com";
  | 	    String to = "ricardo.marques at myserver.com";
  | 	 
  | 		try {
  | 		    // Get system properties
  | 		    Properties props = System.getProperties();
  | 		
  | 		    // Setup mail server
  | 		    Authenticator auth = new PopupAuthenticator();
  | 		    props.put("mail.smtp.host", host);
  | 	            props.put("mail.smtp.auth", "true");
  | 	            
  | 		    // Get session
  | 		    Session session = Session.getInstance(props, auth);
  | 	            session.setDebug(true);
  | 		    //session.setDebug(true);
  | 		
  | 	            
  | 	            
  | 		    // Define message
  | 		    MimeMessage message = new MimeMessage(session);
  | 		
  | 	            
  | 		    // Set the from address
  | 		    message.setFrom(new InternetAddress(from,"Ricardo Marques"));
  | 		
  | 		    // Set the to address
  | 		    message.addRecipient(Message.RecipientType.TO,new InternetAddress(to,"Ricardo Marques"));
  | 		
  | 		    // Set the subject
  | 		    message.setSubject("Hello JavaMail");
  | 		
  | 		    // Set the content
  | 		    message.setText("Welcome to JavaMail");
  | 		
  | 		    // Send message
  | 		    Transport.send(message);
  | 		    System.out.println("OK Man");
  | 		 }
  | 		 catch (Exception e) {
  | 	             e.printStackTrace();
  | 	     }
  | 		 
  | 		 context.leaveNode();
  | 		
  | 	}
  | 	
  | 	static class PopupAuthenticator extends Authenticator {
  |         public PasswordAuthentication getPasswordAuthentication() {
  |             return new PasswordAuthentication("rmarques at myserver.com", "******");
  |         }
  |     }
  | 
  | }
  | 

But just can't see the result of the execution, or any kind of error. On the process instances table, it appears a record about the execution, but nothing else.

The mail code, detach from the jbpm enviromnent, it works, so I suppose that should work on the enviroment.

I want to start the process and receive a e-mail.

Please need some help..!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046768#4046768

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046768



More information about the jboss-user mailing list