jBPM 弃用jndi DataSource

   昨天胡搞了一天,虽然弄好了jBPM的数据库设置,但是经过昨晚回去查看Help 关于deployment的文档和相关的源码,终于弄出最简单的方法。


Help Deployment中关于jbpm.properties

Following properties can be specified in the jbpm.properties configuration file

Table 5.2. 

Property Default Value Description
jbpm.session.factory.jndi.name   if specified, the JbpmSessionFactory.getInstance() method will fetch the singleton instance from the given JNDI location. Otherwise a new JbpmSessionFactory will be created upon initialization of the singleton instance.


源码中的这个JbpmSessionFactory.java类中
 public static JbpmSessionFactory getInstance() {
    if (instance==null) {
     
      // if there is a JNDI name configured
      if (jndiName!=null) {
        try {
          // fetch the JbpmSessionFactory from JNDI
          log.debug("fetching JbpmSessionFactory from '"+jndiName+"'");
          InitialContext initialContext = new InitialContext();
          Object o = initialContext.lookup(jndiName);
          instance = (JbpmSessionFactory) PortableRemoteObject.narrow(o, JbpmSessionFactory.class);
        } catch (Exception e) {
          throw new RuntimeException("couldn't fetch JbpmSessionFactory from jndi '"+jndiName+"'");
        }
       
      } else { // else there is no JNDI name configured
        // create a new default instance.
        log.debug("building singleton JbpmSessionFactory");
        instance = buildJbpmSessionFactory();
      }
    }
    return instance;
  }

可以看到只可以修改jbpm.properties文件就ok了。


现在行动!编辑jbpm\deploy\jbpm.sar中的jbpm.sar.cfg.jar文件

将JbpmSessionFactory修改如下
jbpm.scheduler.service.factory=org.jbpm.scheduler.impl.SchedulerServiceImpl
jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance
#jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory
jbpm.hibernate.cfg.xml=jbpm.hibernate.cfg.xml
#jbpm.hibernate.properties=jbpm.hibernate.properties

因此jbpm.hibernate.properties也可以删除了,之后修改jbpm.hibernate.cfg.xml和另外一个文件的数据库配置,另外弄个数据库的driver就ok啦!!!
posted on 2006-01-12 10:23 fantasyginge 阅读(535) 评论(0)  编辑  收藏 所属分类: 工作流之jBPM

只有注册用户登录后才能发表评论。


网站导航: