[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
17 years
[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
17 years
[JBoss Portal] - EL string compare not working
by Gamba
Hi,
I tried to use a string compare inside the <rich:columnGroup> component. I'm using a map with String, MyType - values and using the follwing code:
| <rich:columnGroup rendered="#{props.attributes['type'] == '1'}">
| <!-- code is rendered -->
| ...
|
Nothing is rendered. When I write the condition with an outputText the output is "1":
| <h:outputText value="props.attributes['type']" />
|
When I try to use the <h:column> element it also works fine and the following code is rendered:
| <h:column rendered="#{props.attributes['type'] == '6'}">
| <!-- code is rendered -->
| ...
|
Additionally when I use <rich:column> instead of columnGroup it also works fine:
| <rich:columnGroup rendered="#{props.attributes['type'] == '6'}">
| <!-- code is rendered -->
| ...
|
Is it a bug or a feature?
Thx
Gamba
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4242114#4242114
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4242114
17 years
[EJB 3.0] - onetomany relationship question
by lpiccoli
i read the 'EJB3 relationships' wiki article
http://www.jboss.org/community/wiki/EJB3relationships and have a question.
| @Entity()
| public class ParentBean implements Serializable
| {
| private Set<ChildBean> listChilds = new HashSet<ChildBean>();
|
| @OneToMany(mappedBy="parent")
| public Set<ChildBean> getChilds()
| {
| return this.listChilds;
| }
| }
|
| @Entity()
| public class ChildBean implements Serializable
| {
| @ManyToOne ()
| public ParentBean getParent()
| {
| return this.parent;
| }
| }
|
|
Q1. essentially why doesnt the following work
| ParentBean parent = ...;
| ChildBean child1 = ...;
| child1.setParent(parent);
|
| ChildBean child2 = ...;
| child2.setParent(parent);
|
| .....
|
| ParentBean parentBean = this.entityManager.find(ParentBean.class, int_ParentId);
|
|
| assertEquals( 2, parentBean.getChilds().size() ); <--- why do i get 0
|
|
Q2. Does the parent.setChilds( list) must be called before calling
parent.getChilds() or can is ok set the relationship with a)child1.setParent(p),
child2.setParent(p) or b) having the data loaded from scripts?
currently my parent.getChilds() returns null although there is
parent/child relationship on the many-to-one table.
Q3. I was expceting that the parent.getChilds() executes a query like ('from child c where c.parent=:parent' )
is my understanding of one-to-many relationship wrong?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4242098#4242098
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4242098
17 years