[jboss-user] [JBoss jBPM] - EJB and jBPM - Q about this code snippet

cwad0000 do-not-reply at jboss.com
Tue Sep 5 08:38:02 EDT 2006


I want to have an container-managed EJB which wraps the calls to jBpm, below is an example of one of the methods i have created.
However, I do get this message from Hibernate(?), and cant see how I should correct my code, isn't I closing correctly?

Any suggestions in general on how to build the EJB (should I throw other stuff into the create/remove methods?)



  | private JbpmConfiguration jbpmConfiguration = null;
  | 
  | public void ejbCreate() throws CreateException {
  |   jbpmConfiguration = JbpmConfiguration.getInstance();
  | }
  | 
  | public void ejbRemove() throws EJBException, RemoteException {
  |   jbpmConfiguration = null;
  | }
  | 
  | 
  | public TaskTO getTaskInformation(long taskid) throws WorkflowEngineException, DataNotFoundException {
  |   String logPrefix2 = logPrefix + ".getTaskInformation() ";
  |   log.debug(logPrefix2 + "Started. taskid=" + taskid);
  | 
  |   JbpmContext jbpmContext = null;
  |   TaskInstance myTaskInstance = null;
  | 
  |   try {
  |     jbpmContext = jbpmConfiguration.createJbpmContext();
  |     if (jbpmContext == null) {
  |       log.warn(logPrefix2 + "jbpmContext is null!");
  |     }
  |   } catch (Exception e) {
  |     String errMsg = "taskid=" + taskid + ", exception thrown by createJbpmContext: " + e;
  |     log.error(logPrefix2 + errMsg);
  |     throw new WorkflowEngineException(errMsg);
  |   }
  | 
  |   TaskTO myTask = null;
  | 
  |   try {
  |     TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
  |     if (taskMgmtSession == null) {
  |       log.warn(logPrefix2 + "taskMgmtSession is null!");
  |     }
  | 
  |     myTaskInstance = taskMgmtSession.loadTaskInstance(taskid);
  | 
  |     if (myTaskInstance != null) {
  |       myTask = this.taskInstance2TaskTO(myTaskInstance);
  |     } else {
  |       log.warn(logPrefix2 + "myTaskInstance is null!");
  |     }
  |   } catch (Exception e) {
  |     String errMsg = "taskid=" + taskid + ", exception thrown by getTaskMgmtSession/findTaskInstances: " + e;
  |     log.error(logPrefix2 + errMsg);
  |     throw new WorkflowEngineException(errMsg);
  |   } finally {
  |     jbpmContext.close();
  |   }
  |   return myTask;
  | }
  | 




  | 14:15:46,064 INFO : Closing a connection for you.  Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection at 718c0c
  | java.lang.Throwable: STACKTRACE
  | 
  | 	at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:333)
  | 
  | 	at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:482)
  | 
  | 	at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
  | 
  | 	at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)
  | 
  | 	at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
  | 
  | 	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:304)
  | 
  | 	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:109)
  | 
  | 	at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:134)
  | 
  | 	at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
  | 
  | 	at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1236)
  | 
  | 	at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:98)
  | 
  | 	at org.jbpm.persistence.db.DbPersistenceService.getTaskMgmtSession(DbPersistenceService.java:262)
  | 
  | 	at org.jbpm.JbpmContext.getTaskMgmtSession(JbpmContext.java:545)
  | 
  | 	at mystuff.WorkflowManagerBean.getTaskInformation(WorkflowManagerBean.java:362)
  | 
  | 	at mystuff.WorkflowManagerBean.getUserHistory(WorkflowManagerBean.java:441)
  | 
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 
  | 	at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
  | 
  | 	at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
  | 
  | 	at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
  | 
  | 	at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
  | 
  | 	at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
  | 
  | 	at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
  | 
  | 	at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
  | 
  | 	at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
  | 
  | 	at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
  | 
  | 	at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
  | 
  | 	at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
  | 
  | 

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

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



More information about the jboss-user mailing list