[JBoss jBPM] - Hibernate error while deploying process in a web application
by vignesh57
i am trying to implement jBPM in a J2EE Web application. I am doing three things.
1) Deploy a process
2) Start an instance.
3) Show a list of available instances.
My Environment:
jBPM : 3.2.X
jBoss : 4.2.X
Database: MySQL
Below is the piece of code embedded in a method inside a DAO class. This is invoked from the servlet when the user hits the Deploy button in the jsp page.
| public String redeployProcess(String processName) {
| System.out.println("->public String redeployProcess(String processName)");
| System.out.println("----->Creating jBPM Configuration....");
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| System.out.println("----->Parsing process definition....");
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource(processName);
| System.out.println("----->Deploying Process definition....");
| jbpmContext.deployProcessDefinition(processDefinition);
| System.out.println("----->Deploy Successful....");
| return "Process " + processDefinition.getName() + " redeployed.";
| } finally {
| System.out.println("----->Closing jBPM Context....");
| jbpmContext.close();
| }
| }
|
And this is the exception i got....
| ->public String redeployProcess(String processName)
| 13:45:38,882 INFO [STDOUT] ----->Creating jBPM Configuration....
| 13:45:38,882 INFO [STDOUT] ----->Parsing process definition....
| 13:45:38,928 INFO [STDOUT] ----->Deploying Process definition....
| 13:45:38,928 INFO [STDOUT] ----->Closing jBPM Context....
| 13:45:38,928 ERROR [[JBPMServlet]] Servlet.service() for servlet JBPMServlet threw exception
| org.hibernate.HibernateException: No CurrentSessionContext configured!
| at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)
| at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:90)
| at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:330)
| at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:636)
| at org.jbpm.JbpmContext.deployProcessDefinition(JbpmContext.java:170)
| at com.sample.dao.JBPMDao.redeployProcess(JBPMDao.java:23)
| at com.sample.JBPMServlet.doGet(JBPMServlet.java:34)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
| at java.lang.Thread.run(Thread.java:595)
|
Works well in Tomcat !
I ran this application in Tomcat and it worked perfectly alright. Initially i faced some problems but with the help of existing posts, i made it work well.....
Why not in jBoss ?
If it works well in Tomcat, then it must work in jBoss too. And also i dont know Hibernate. I can see that it is trying to get a Session through SessionFactoryImpl.getCurrentSession() and the effort fails.
But how is it able to get one in Tomcat ?
Any help here would be deeply appreciated. if I am missing out to provide any info, please do ask me.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4242120#4242120
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4242120
16 years, 9 months
[JBoss jBPM] - jBPM4: Error deleting process definition history (with fix)
by kevinw
I'm currently running against jBPM 4 trunk and encountered following error when cleaning up after a test case:
| Caused by: java.sql.SQLException: Integrity constraint violation FK_HAI_HPI table: JBPM4_HIST_ACTINST in statement [delete from JBPM4_HIST_PROCINST where ID_=? and DBVERSION_=?]
| at org.hsqldb.jdbc.Util.throwError(Unknown Source)
| at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
| at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2551)
| ... 37 more
|
Turning around the order of deletion in DeleteDeploymentCmd fixes this issue on my end. Here's the diff:
| Index: modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java
| ===================================================================
| --- modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java (revision 5252)
| +++ modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteDeploymentCmd.java (working copy)
| @@ -72,12 +72,15 @@
| .list();
|
| if (cascade) {
| +
| + dbSession.deleteProcessDefinitionHistory(processDefinitionId);
| +
| for (ProcessInstance processInstance: processInstances) {
| dbSession.deleteProcessInstance(processInstance.getId(), true);
| }
|
| - dbSession.deleteProcessDefinitionHistory(processDefinitionId);
|
| +
| } else {
| if (!processInstances.isEmpty()) {
| throw new JbpmException("cannot delete deployment "+deploymentId+": still executions for "+processDefinition+": "+processInstances);
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4242115#4242115
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4242115
16 years, 9 months
[JBoss jBPM] - Re: Saving long spanning process in jBPM 4.0
by nazarfm
Let me try to explain myself better. I did read the User guide for version 4.0, the developer guide had some outdated API but i've read that as well.
Let's say, when i reach a certain node, I call an asynchronous job. When this job is complete, it will call a callback method, say callbackAtoB(). From within this callback method, I need to signal so that execution can proceed to the next state.
I attempted to solve it using an eventListener A which is triggered when state A is entered. For simplicity's sake, I keep the processEngine in a static field. I instantiate the process. Now when callbackAtoB() is called, I use the executionId given in the eventListener in an attempt to singal. However, I get that org.jbpm.api.JbpmException: execution Process.1 does not exist.
So I was wondering if there is another way of doing it, or is there a simple thing i missing.
thanx in advance :)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4242009#4242009
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4242009
16 years, 9 months