5 Replies Latest reply on Dec 13, 2007 9:45 AM by pmuir

    JBPM and Seam problem

    trouby

      Hey,

      I was wondering why Seam deploys each jbpm process every time I start JBossAS, that's the normal behavior? after few restarts JBPM tables looks too dirty, I think it would be wise to check the version of the process somehow and only deploy when a change occurs,


      Anyway, I tried to avoid setting my processes through components.xml and deploy them in runtime but I'm having some problems,

      Here's my try:
      {code}
      @In(value="org.jboss.seam.bpm.jbpm")
      private Jbpm jbpm;

      @In
      private JbpmContext jbpmContext;

      ProcessDefinition pd = jbpm.getProcessDefinitionFromXml(xmlProcessDefinition);
      jbpmContext.deployProcessDefinition(pd);
      {code}



      At the moment jbpm.getProcessDefinitionFromXml(xmlProcessDefinition); gets invoked I see many JBPM lines warming up and then I get the following exceptions:


      {code}
      20:18:16,234 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
      20:18:16,234 INFO [SchemaUpdate] Running hbm2ddl schema update
      20:18:16,250 INFO [SchemaUpdate] fetching database metadata
      20:18:16,250 ERROR [SchemaUpdate] could not get database metadata
      java.sql.SQLException: You cannot set autocommit during a managed transaction!
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.setJdbcAutoCommit(BaseWrapperManagedConnecti
      ava:482)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.java:322)
      at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderC
      ctionHelper.java:36)
      at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:127)
      at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:314)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
      at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91
      at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
      at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:98)
      at org.jbpm.JbpmContext.getSession(JbpmContext.java:506)
      at org.jboss.seam.bpm.ManagedJbpmContext.joinTransaction(ManagedJbpmContext.java:175)
      at org.jboss.seam.bpm.ManagedJbpmContext.getJbpmContext(ManagedJbpmContext.java:145)
      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:597)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2067)
      at org.jboss.seam.Component.unwrap(Component.java:2093)
      ....
      {code}



      It's working, I mean, JBPM starts(many lines appear, all JBPM conf mappings, etc...), then the process gets deployed and everything work.

      well, after the first deployment time, I don't see this errors again and all work perfectly...(unless I restart Jboss again of course)



      As a workaround, I just left one process within components.xml so seam starts JBPM when the -server starts-, so no error occur that way, but it's ugly...

      I guess I'm already in a transaction and then JBPM starts in the middle or something... if so, is there a way to start JBPM when the server loads? (without setting any processes in components.xml?), if it's another issue then fix me :)


      Many thanks,

      Asaf.

        • 1. Re: JBPM and Seam problem
          pmuir

          The process definition deployment within seam is for development only. http://jira.jboss.com/jira/browse/JBSEAM-198

          • 2. Re: JBPM and Seam problem
            trouby

            For deployment only? what do you mean by that?

            So what came out of this ticket? none yet?


            So what is the best practice in production use right now?
            modify components.xml, deploy, then clean components.xml?, this sounds too dirty to me..


            Anyway, I would like to deploy processes out of my ear file, thus I'm using jbpm.getProcessDefinitionFromXml which works but for the first time it thorugh the exception as I mentioned below.

            any clue about this issue?


            Thanks.

            • 3. Re: JBPM and Seam problem
              pmuir

              For development only == not for use in production (i.e. when you deploy with a clean db each time. The issue is still open so no work is done.

              Deploy the process using some jbpm means and use an empty

              <bpm:jbpm />


              in components.xml (I think this is working)

              • 4. Re: JBPM and Seam problem
                trouby

                Alright,

                and nah, it's not working, I already tried it,
                Jbpm does not load itself when server starts with empty '<bpm:jbpm />' tag,

                (jbpm starts at the moment I make a use of it in runtime, but that causes transaction exceptions when it's done on later stages)

                so as a workaround I just left an empty process in component.xml, but this is too dirty as it deploys every restart an unneeded process :-/



                many thanks!

                • 5. Re: JBPM and Seam problem
                  pmuir

                  Ok, I will look at that when I get a minute :)