[jboss-user] [JBoss jBPM] - Integrating JBPM in web application

Froschfinger do-not-reply at jboss.com
Sun Nov 19 10:47:27 EST 2006


Hi,
i want to integrate JBPM in my web application. I wrote a servlet which starts a process with an action handler. But if i deploy this in my Jboss it occurs a ClassNotFoundException. My Actionhandler is in the same directory and i dont understand it. Could somebody give me some hints?

My Servlet:



  | 
  | import java.io.IOException;
  | 
  | import javax.servlet.ServletException;
  | import javax.servlet.http.HttpServletRequest;
  | import javax.servlet.http.HttpServletResponse;
  | 
  | import org.jbpm.JbpmConfiguration;
  | import org.jbpm.JbpmContext;
  | import org.jbpm.graph.def.ProcessDefinition;
  | import org.jbpm.graph.exe.ProcessInstance;
  | 
  | /**
  |  * Servlet implementation class for Servlet: TestServlet
  |  *
  |  */
  |  public class TestServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
  |     /* (non-Java-doc)
  | 	 * @see javax.servlet.http.HttpServlet#HttpServlet()
  | 	 */
  | 	public TestServlet() {
  | 		super();
  | 	}   	
  | 	
  | 	/* (non-Java-doc)
  | 	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
  | 	 */
  | 	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  | 		
  | 		JbpmConfiguration jbpmConfig=JbpmConfiguration.parseXmlString(
  | 				"<jbpm-configuration>"+
  | 
  | 				
  | 
  | 				"</jbpm-configuration>");
  | 		
  | 		
  | 		
  | 		
  | 		JbpmContext context=jbpmConfig.createJbpmContext();
  | 		
  | 		try {
  | 			ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
  | 					  "<process-definition>" +
  | 					  "  <start-state>" +
  | 					  "    <transition to='s'>" +
  | 					  "			<action name='action' class='MyActionHandler'>"+
  | 					  "				<message>Going to the first state!</message>"+
  | 					  " 		</action>"+
  | 					  "	   </transition>"+
  | 					  "  </start-state>" +
  | 					  "  <state name='s'>" +
  | 					  "    <transition to='end' />" +
  | 					  "  </state>" +
  | 					  "  <end-state name='end' />" +
  | 					  "</process-definition>"
  | 					);
  | 			 
  | 			 ProcessInstance processInstance = 
  | 			      new ProcessInstance(processDefinition);
  | 			  
  | 			  // After construction, the process execution has one main path
  | 			  // of execution (=the root token).
  | 			  processInstance.signal();
  | 			  
  | 			  // Also after construction, the main path of execution is positioned
  | 			  // in the start-state of the process definition.
  | 			  
  | 			  // Let's start the process execution, leaving the start-state 
  | 			  // over its default transition.
  | 			  
  | 			  // The signal method will block until the process execution 
  | 			  // enters a wait state.
  | 			  processInstance.end();
  | 			
  | 		}finally{
  | 			context.close();
  | 		}
  | 	}
  | 	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  | 		
  | 	}   	
  | }

My ActionHandler:




  | import org.jbpm.graph.def.ActionHandler;
  | import org.jbpm.graph.exe.ExecutionContext;
  | 
  | 
  | public class MyActionHandler implements ActionHandler{
  | 
  | 	/**
  | 	 * 
  | 	 */
  | 	private static final long serialVersionUID = 1L;
  | 
  | 	public void execute(ExecutionContext arg0) throws Exception {
  | 
  | 		System.out.println("######################");
  | 		System.out.println("Mail senden");
  | 		System.out.println("######################");
  | 	}
  | 
  | }

Is there a special File hierarchy which i have to use? 

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

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



More information about the jboss-user mailing list