2 Replies Latest reply on May 25, 2006 6:10 AM by koen.aers

    Getting jBPM to use an existing Hibernate session factory

    wasperen

      Following configuration:

       <jbpm-context>
       <service name="persistence">
       <bean name="dbpersistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory">
       <property name="sessionFactoryJndiName">
       <string value="java:/hibernate/JbpmSessionFactory" />
       </property>
       </bean>
       </service>
       <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
       <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
       <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
       <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
       </jbpm-context>
      

      The Hibernate Session Factory is there and works, but when I create a new jBPM context, I get:

      10:41:43,831 DEBUG [JBPMUtil] Creating jBPM context
      10:41:43,832 DEBUG [JBPMUtil] Creating initial JNDI context.
      10:41:43,834 DEBUG [JBPMUtil] Getting jBPM Configuration MBean
      10:41:43,837 DEBUG [JBPMUtil] Got the jBPM Configuration of type org.jbpm.JbpmConfiguration
      10:41:43,859 DEBUG [JbpmContextInfo] creating jbpm context with service factories '[message, scheduler, logging, persistence, authentication]'
      10:41:43,859 DEBUG [JbpmContext] creating JbpmContext
      10:41:43,860 DEBUG [JBPMUtil] Created jBPM context org.jbpm.JbpmContext@11afcfd4
      10:41:43,860 DEBUG [JBPMUtil] Setting actorid to wasperen
      10:41:43,862 DEBUG [DbPersistenceServiceFactory] creating persistence service
      10:41:43,868 DEBUG [DbPersistenceServiceFactory] building hibernate session factory
      10:41:43,871 DEBUG [HibernateHelper] using default hibernate configuration resource (hibernate.cfg.xml)
      10:41:43,872 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
      10:41:43,872 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
      10:41:43,875 ERROR [JBPMPage] Page 'Home' failed to get the task list.
      10:41:43,876 DEBUG [JBPMPage] Page 'Home' is closing a jBPM Context.
      10:41:43,876 DEBUG [JbpmContext] closing JbpmContext
      10:41:43,877 DEBUG [Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@6ff58334
      10:41:43,877 DEBUG [Services] closing service 'authentication': org.jbpm.security.authentication.DefaultAuthenticationService@5f790458
      

      Why is it creating a new persistence service at 10:41:43,862 and building a new hibernate session factory?

      Thanks,
      Willem

        • 1. Re: Getting jBPM to use an existing Hibernate session factor
          wasperen

          In fact, when I deployed the above configuration, I get:

          11:09:54,064 INFO [SettingsFactory] Default entity-mode: pojo
          11:09:54,122 INFO [SessionFactoryImpl] building session factory
          11:09:58,389 INFO [JbpmConfiguration] using jbpm configuration resource 'jbpm.cfg.xml'
          11:09:58,984 WARN [ServiceController] Problem starting service jboss.hibernate:name=JbpmHibernateService,service=HibernateService
          java.lang.ExceptionInInitializerError
          

          snip
          Caused by: org.jbpm.JbpmException: couldn't parse 'jbpm-context' into a 'org.jbpm.configuration.JbpmContextInfo': <?xml version="1.0" encoding="UTF-8"?><jbpm-context name="default.jbpm.context">
           <service name="persistence">
           <bean factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" name="dbpersistence">
           <property name="sessionFactoryJndiName">
           <string value="java:/hibernate/JbpmSessionFactory"/>
           </property>
           </bean>
           </service>
           <service factory="org.jbpm.msg.db.DbMessageServiceFactory" name="message"/>
           <service factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" name="scheduler"/>
           <service factory="org.jbpm.logging.db.DbLoggingServiceFactory" name="logging"/>
           <service factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" name="authentication"/>
           </jbpm-context>
           at org.jbpm.configuration.ObjectFactoryParser.parse(ObjectFactoryParser.java:126)
          

          Mind you: that is before the jBPM Configuration is (suposedly) being built...
          Why is Hibernate bothering at that stage with a JbpmConfiguration?
          What is wrong with the configuration?
          ...
          Willem

          • 2. Re: Getting jBPM to use an existing Hibernate session factor
            koen.aers

            Willem,

            What is the exact stacktrace? And what is your exact configuration? I suspect some version clash somewhere, but there is too little info to draw some conclusions.

            Regards,
            Koen