This content has been marked as final.
Show 6 replies
-
1. Re: Autostart process on JBoss start
kukeltje Dec 19, 2007 11:29 AM (in response to candersen)Yes, use e.g. startupservlet or something like that.
-
2. Re: Autostart process on JBoss start
candersen Dec 21, 2007 5:21 AM (in response to candersen)Hello,
thanks for the answer, it works, but not to the extent I like it to work. I wrote a class that should start my process, it looks like this:package myPackage.process; import java.io.IOException; import javax.servlet.Servlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import org.jbpm.JbpmConfiguration; import org.jbpm.JbpmContext; public class ProzessStarter implements Servlet { public void init(ServletConfig config) throws ServletException { JbpmConfiguration jc = JbpmConfiguration.getInstance(); JbpmContext jcx = jc.createJbpmContext(); jc.startJobExecutor(); jcx.newProcessInstance("MyProcess").signal(); } public void destroy() { } public ServletConfig getServletConfig() { // TODO Auto-generated method stub return null; } public String getServletInfo() { // TODO Auto-generated method stub return null; } public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException { // TODO Auto-generated method stub } }
I added the servlet to the web.xml of the jbpm-console.war:<servlet> <servlet-name>ZKSStartupServlet</servlet-name> <servlet-class>dev.zksabfall.service.prozess.ProzessStarter</ servlet-class> <load-on-startup>2</load-on-startup> </servlet>
It starts the process on startup of the server, but I have a timer in the first state the process goes into. The problem is now: The timer isn't fired, the process waits in the state.
Am I missing something in the code of the servlet? -
3. Re: Autostart process on JBoss start
candersen Dec 21, 2007 5:22 AM (in response to candersen)Sorry, the code in the web.xml looks like this:
<servlet> <servlet-name>StartupServlet</servlet-name> <servlet-class>myPackage.process</servlet-class> <load-on-startup>2</load-on-startup> </servlet>
-
4. Re: Autostart process on JBoss start
candersen Dec 21, 2007 5:23 AM (in response to candersen)And sorry again, now it is correct:
<servlet> <servlet-name>StartupServlet</servlet-name> <servlet-class>myPackage.process.ProzessStarter</servlet-class> <load-on-startup>2</load-on-startup> </servlet>
-
5. Re: Autostart process on JBoss start
candersen Dec 21, 2007 5:43 AM (in response to candersen)I found a "solution". When I add
jcx.close
after signalling the process, it works.
Is this the correct way to do this?
Regards
Claus -
6. Re: Autostart process on JBoss start
kukeltje Dec 21, 2007 7:34 AM (in response to candersen)according to the docs it is...