0 Replies Latest reply on Apr 1, 2008 9:39 PM by wan agus

    How to call Seam SLSB from a jbpm-invoked action?

    wan agus Newbie

      Hi all,

      I posted this question at seamframework.org forum but haven't seen any answers so I'm trying my luck in this forum.

      My seam project has the jbpm module enabled and I'm wondering how I can get my jbpm action handler to access a Seam component/object.

      For example, in my jpdl, I have a transition which has an action handler pointing to test.transitionHandler class.

      Inside the transitionHandler.class, I have something like below.

      Component comp = Seam.componentForName("fruitManager");
      assert comp !=null;
      FruitManager fm= (FruitManager) comp.newInstance();
      fm.updateDescription(1, "Apple");


      fruitManager is a name of a SLSB. updateDescription() simply updates the description field of the Fruit bean and persist it.

      When executed, here's the stack trace that shows:


      17:53:34,406 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
      17:53:34,406 ERROR [JDBCExceptionReporter] Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fffd:da4:47f28229:3b9 status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fffd:da4:47f28229:3b9 status: ActionStatus.ABORT_ONLY >))
      17:53:34,406 INFO [DefaultLoadEventListener] Error performing load command
      org.hibernate.exception.GenericJDBCException: Cannot open connection
       at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
       at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
       at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
       at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
       at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
       at org.hibernate.loader.Loader.doQuery(Loader.java:673)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
       at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
       at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
       at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
       at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
       at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
       at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
       at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
       at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:174)
       at org.jboss.ejb3.entity.TransactionScopedEntityManager.find(TransactionScopedEntityManager.java:171)
       at org.jboss.seam.persistence.EntityManagerProxy.find(EntityManagerProxy.java:85)
       at test.FruitManagerBean.updateDescription(ImageTicketManagerBean.java:739)


      Note that the Seam application and JBPM are using different database schema. They're also both configured to use XA transactions/driver.

      Thanks for your help!