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

    JBPM and Seam problem

    asaf sh Expert


      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:
      private Jbpm jbpm;

      private JbpmContext jbpmContext;

      ProcessDefinition pd = jbpm.getProcessDefinitionFromXml(xmlProcessDefinition);

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

      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
      at org.jboss.resource.adapter.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.java:322)
      at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderC
      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)

      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,