0 Replies Latest reply on May 16, 2006 11:45 AM by wasperen

    Why does HibernateService create a JbpmConfiguration when pu

    wasperen

      Dear All,

      This might sound off-topic... But I have jBPM pop up in my Hibernate set-up...

      All I am trying to do is have an Hibernate Session Factory and a jBPM Configuration set-up as two MBeans. In my initial tests I saw from the log that the Hibernate factory got built two times: at server startup (what you would expect) and secondly as soon as my application started to use it (yes, I did refer to it by JNDI name). Because I did not understand why, I decided to try to build this from the ground up. And there is when I found this funny feature...

      Datasource: ok.
      HibernateService, configured as:

      <mbean code="org.hibernate.jmx.HibernateService"
       name="jboss.hibernate:name=JbpmHibernateService,service=HibernateService">
      
       <!-- Backward Dependencies -->
       <depends>jboss.jca:service=DataSourceBinding,name=JbpmDS</depends>
      
       <!-- Naming -->
       <attribute name="JndiName">java:/hibernate/JbpmSessionFactory</attribute>
      
       <!-- Data Source -->
       <attribute name="Datasource">java:/JbpmDS</attribute>
       <attribute name="Dialect">org.hibernate.dialect.PostgreSQLDialect</attribute>
       <attribute name="UserName">jbpm</attribute>
       <attribute name="Password"></attribute>
      
       <!-- Transaction integration -->
       <attribute name="TransactionStrategy">org.hibernate.transaction.JTATransactionFactory</attribute>
       <attribute name="TransactionManagerLookupStrategy">org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
       <attribute name="FlushBeforeCompletionEnabled">true</attribute>
       <attribute name="AutoCloseSessionEnabled">true</attribute>
      
       <!-- Fetching options -->
       <attribute name="MaximumFetchDepth">5</attribute>
      
       <!-- Second-level caching -->
       <attribute name="SecondLevelCacheEnabled">false</attribute>
       <attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
       <attribute name="QueryCacheEnabled">false</attribute>
      
       <!-- Logging -->
       <attribute name="ShowSqlEnabled">true</attribute>
      
       <!-- Mapping files -->
       <attribute name="MapResources">
       org/jbpm/db/hibernate.queries.hbm.xml
       org/jbpm/graph/action/Script.hbm.xml
       org/jbpm/identity/User.hbm.xml
       org/jbpm/identity/Group.hbm.xml
       org/jbpm/identity/Membership.hbm.xml
       org/jbpm/graph/def/ProcessDefinition.hbm.xml
       org/jbpm/graph/def/Node.hbm.xml
       org/jbpm/graph/def/Transition.hbm.xml
       org/jbpm/graph/def/Event.hbm.xml
       org/jbpm/graph/def/Action.hbm.xml
       org/jbpm/graph/def/SuperState.hbm.xml
       org/jbpm/graph/def/ExceptionHandler.hbm.xml
       org/jbpm/instantiation/Delegation.hbm.xml
       org/jbpm/graph/node/StartState.hbm.xml
       org/jbpm/graph/node/EndState.hbm.xml
       org/jbpm/graph/node/ProcessState.hbm.xml
       org/jbpm/graph/node/Decision.hbm.xml
       org/jbpm/graph/node/Fork.hbm.xml
       org/jbpm/graph/node/Join.hbm.xml
       org/jbpm/graph/node/State.hbm.xml
       org/jbpm/graph/node/TaskNode.hbm.xml
       org/jbpm/context/def/ContextDefinition.hbm.xml
       org/jbpm/context/def/VariableAccess.hbm.xml
       org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml
       org/jbpm/taskmgmt/def/Swimlane.hbm.xml
       org/jbpm/taskmgmt/def/Task.hbm.xml
       org/jbpm/taskmgmt/def/TaskController.hbm.xml
       org/jbpm/module/def/ModuleDefinition.hbm.xml
       org/jbpm/bytes/ByteArray.hbm.xml
       org/jbpm/file/def/FileDefinition.hbm.xml
       org/jbpm/scheduler/def/CreateTimerAction.hbm.xml
       org/jbpm/scheduler/def/CancelTimerAction.hbm.xml
       org/jbpm/graph/exe/Comment.hbm.xml
       org/jbpm/graph/exe/ProcessInstance.hbm.xml
       org/jbpm/graph/exe/Token.hbm.xml
       org/jbpm/graph/exe/RuntimeAction.hbm.xml
       org/jbpm/module/exe/ModuleInstance.hbm.xml
       org/jbpm/context/exe/ContextInstance.hbm.xml
       org/jbpm/context/exe/TokenVariableMap.hbm.xml
       org/jbpm/context/exe/VariableInstance.hbm.xml
       org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml
       org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml
       org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml
       org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml
       org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml
       org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml
       org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml
       org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml
       org/jbpm/msg/Message.hbm.xml
       org/jbpm/msg/db/TextMessage.hbm.xml
       org/jbpm/command/ExecuteActionCommand.hbm.xml
       org/jbpm/command/ExecuteNodeCommand.hbm.xml
       org/jbpm/command/SignalCommand.hbm.xml
       org/jbpm/command/TaskInstanceEndCommand.hbm.xml
       org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml
       org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml
       org/jbpm/taskmgmt/exe/PooledActor.hbm.xml
       org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml
       org/jbpm/scheduler/exe/Timer.hbm.xml
       org/jbpm/logging/log/ProcessLog.hbm.xml
       org/jbpm/logging/log/MessageLog.hbm.xml
       org/jbpm/logging/log/CompositeLog.hbm.xml
       org/jbpm/graph/log/ActionLog.hbm.xml
       org/jbpm/graph/log/NodeLog.hbm.xml
       org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml
       org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml
       org/jbpm/graph/log/SignalLog.hbm.xml
       org/jbpm/graph/log/TokenCreateLog.hbm.xml
       org/jbpm/graph/log/TokenEndLog.hbm.xml
       org/jbpm/graph/log/TransitionLog.hbm.xml
       org/jbpm/context/log/VariableLog.hbm.xml
       org/jbpm/context/log/VariableCreateLog.hbm.xml
       org/jbpm/context/log/VariableDeleteLog.hbm.xml
       org/jbpm/context/log/VariableUpdateLog.hbm.xml
       org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml
       org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml
       org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml
       org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml
       org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml
       org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml
       org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml
       org/jbpm/taskmgmt/log/TaskLog.hbm.xml
       org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml
       org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml
       org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml
       org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml
       org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml
       org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml</attribute>
       <!-- NewsItem.hbm.xml</attribute> -->
       </mbean>
      


      This seems to work. The full log dump I will spare you, but this comes up after Hibernate has read all the hbm.xml files from the jbpm.jar and jbpm-identity.jar, confirms the use of the correct DataSource and the TransactionManager stuff.

      17:27:28,325 INFO [SettingsFactory] Statistics: disabled
      17:27:28,326 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
      17:27:28,326 INFO [SettingsFactory] Default entity-mode: pojo
      17:27:28,374 INFO [SessionFactoryImpl] building session factory
      17:27:31,435 INFO [JbpmConfiguration] using jbpm configuration resource 'jbpm.cfg.xml'
      17:27:35,449 INFO [SessionFactoryObjectFactory] Factory name: java:/hibernate/JbpmSessionFactory
      17:27:35,450 INFO [NamingHelper] JNDI InitialContext properties:{}
      17:27:35,451 INFO [NamingHelper] Creating subcontext: hibernate
      17:27:35,452 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:/hibernate/JbpmSessionFactory
      17:27:35,453 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
      17:27:35,454 INFO [NamingHelper] JNDI InitialContext properties:{}
      

      Some more configuration stuff:


      * Everything is packed into a .sar, including the *.jar's
      * And that is the only place where they are: in the /lib folder in the .sar
      * The jbpm.cfg.xml is in the / of the .sar
      * As is the -ds datasource definition.


      The jbpm.cfg.xml file says:
      <jbpm-configuration>
      
       <jbpm-context>
       <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory">
       <field name="sessionFactoryJndiName">
       <string value="java:/hibernate/JbpmSessionFactory" />
       </field>
       </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>
      
       <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
       <!-- <string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" /> -->
       <!-- <string name="resource.hibernate.properties" value="hibernate.properties" /> -->
      
       <!-- <string name="resource.hibernate.queries.hbm.xml" value="org/jbpm/db/hibernate.queries.hbm.xml" /> -->
       <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
       <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
       <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
       <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
       <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
       <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
       <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
      
       <bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" />
       <bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
       <long name="jbpm.msg.wait.timout" value="5000" singleton="true" />
      
      </jbpm-configuration>
      


      Finally, some things I have tried:


      * Removing the jbpm.cfg.xml creates the comment "cannot find jbpm.cfg.xml, using minimal configuration" or something.
      * Having all the relevant .jar files in the server/lib folder gives identical results.
      * Having the -ds.xml file in server/deploy also identical results.

      What am I missing?

      Thanks,
      Willem