Hi,
I know exactly where the problem is but I don't know the best way to solve it.

The problem is I have two JbpmConfigurations. It is ok that there is no current 
JbpmContex, when saving process instance by hibernate, because jbpmContext is 
closed and it uses default JbpmConfiguration which should have the same 
objectFactory. But it does't because context was created on another 
configuration. 

Why I have 2 JbpmConfigurations? First is created when hibernate is scanning 
classes for mapping. Class org.jbpm.job.Timer is persistent and it has static 
attribute:
static BusinessCalendar businessCalendar = new BusinessCalendar();

  | Constructor of BusinessCalendar look like this:
  |   public static synchronized Properties getBusinessCalendarProperties() {
  |     if (businessCalendarProperties==null) {
  |       String resource = 
JbpmConfiguration.Configs.getString("resource.business.calendar");
  |       businessCalendarProperties = ClassLoaderUtil.getProperties(resource);
  |     }
  |     return businessCalendarProperties;
  |   }
  | 
  |   public BusinessCalendar() {
  |     this(getBusinessCalendarProperties());
  |   }
  | 
So this creates first Configuration.

Second is created programmatically as a Spring bean and injected into 
JbpmTemplate.

  |     <!-- jBPM configuration -->
  |     <bean 
class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean" 
id="jbpmConfiguration">
  |             <property name="sessionFactory" ref="sessionFactory"/>
  |             <property name="configuration" value="classpath:jbpm.cfg.xml"/>
  |             <property name="processDefinitionsResources">
  |                     <list>
  |                             
<value>classpath:processDefinitions/FlowTest.xml</value>
  |                     </list>
  |             </property>
  |     </bean>
  | 
  |     <!-- jBPM template -->
  |     <bean class="org.springmodules.workflow.jbpm31.JbpmTemplate" 
id="jbpmTemplate">
  |             <property name="jbpmConfiguration">
  |                     <ref bean="jbpmConfiguration"/>
  |             </property>     
  |             <property name="hibernateTemplate">
  |                     <ref bean="hibernateTemplate"/>
  |             </property>     
  |     </bean>
  | 
Problem is that this configuration is not in static map 
JbpmConfiguration.instances because it is created this way:

  | ObjectFactory jbpmObjectFactory;
  | 
  |             // 1. create the configuration from the file
  |             if (configuration != null) {
  |                     logger.info("creating JbpmConfiguration from resource " 
+ configuration.getDescription());
  |                     InputStream stream = configuration.getInputStream();
  |                     jbpmObjectFactory = 
ObjectFactoryParser.parseInputStream(stream);
  |                     stream.close();
  |             }
  |             else
  |                     jbpmObjectFactory = objectFactory;
  | 
  |             jbpmConfiguration = new JbpmConfiguration(jbpmObjectFactory);
  | 


So what should I do? I think this is wrong way and they should use 
JbpmConfiguration getInstance(String resource) to create configuration. Have 
anyone experience with spring module?

Thanks a lot

Fero

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197817#4197817

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4197817
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to