This content has been marked as final.
Show 3 replies
-
1. Re: JBPM Context in Startup servlet
kukeltje.ronald.jbpm.org Apr 30, 2008 4:55 AM (in response to zahidmaqbool)
But if i try to get it done through a startup servlet I am unable to get the JBPM context.Errors? Code? now it is just guessing for us and we are not good at that ;-)
-
2. Re: JBPM Context in Startup servlet
zahidmaqbool Apr 30, 2008 5:27 AM (in response to zahidmaqbool)public class Test { @In JbpmContext jbpmContext; public void testQuartz() { System.out.println("TRYING TO Execute TEST JOB"); JobDetail jobDetail = new JobDetail("testJob", null, TestJob.class); jbpmContext.loadProcessInstance(1l); jobDetail.getJobDataMap().put("jbpmContext", jbpmContext); SimpleTrigger trigger = new SimpleTrigger("trigger1", "group1"); trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY); trigger.setRepeatInterval(30L * 1000L); try { Scheduler sched = StdSchedulerFactory.getDefaultScheduler(); //sched.addGlobalJobListener(new Listener()); sched.scheduleJob(jobDetail, trigger); sched.start(); System.out.println(trigger.getNextFireTime()); } catch (Exception e) { e.printStackTrace(); } } }
When I load processInstance, it throws an error on JBPM Context as Null
-
3. Re: JBPM Context in Startup servlet
zahidmaqbool May 1, 2008 2:37 AM (in response to zahidmaqbool)O.k. I got it working.
I used the @Observer annotation to get it done, of course I took help from... cant remember the name, but someone in this forum :))
Also the Jbpm context is only available in a transaction.
So here is my small piece of code which did the job. This is without quartz so that the size doesn't increases.
@Transactional @Name("startupTesting") public class StartupTesting { @Logger private Log log; @In JbpmContext jbpmContext; /** * This is called by seam after initialization * has finished. */ @Observer("org.jboss.seam.postInitialization") public void observe() { try { log.info("Trying to load Test Jbpm Process Instance"); org.jbpm.graph.exe.ProcessInstance pi = jbpmContext.loadProcessInstance(60787l); System.out.println(pi.getKey()+" ----- "+pi.getStart()); } catch(Exception e) { e.printStackTrace(); log.info("Operation Failed"); } log.info("About to load system properties"); } }