论坛首页 Java企业应用论坛

jbpm 3.2.2+Tomcat 6.0.10+MySQL5.0.27/MSSQL2000全攻略五

浏览 1161 次
该帖已经被评为隐藏帖
作者 正文
   发表时间:2008-08-03  

            e)、修改Tomcat安全验证

               有两种方法修改安全验证,第一种是修改%TOMCAT_HOME%\conf下的tomcat-users.xml文件,第二种是在%TOMCAT_HOME%\conf目录下再新建Catalina文件夹,然后再在Catalina文件夹下建localhost文件夹,在此目录下建jbpm-console.xml文件。

               i、修改tomcat-users.xml文件

                   修改前请备份tomcat-users.xml文件,修改后的内容如下:

<?xml version='1.0' encoding='utf-8'?>

<tomcat-users>

  <role rolename="user"/>

  <role rolename="administrator"/>

  <role rolename="manager"/>

  <role rolename="sales"/>

  <role rolename="hr"/>

  <role rolename="admin"/>

  <role rolename="participant"/>

  <user username="user" password="user" roles="user,sales"/>

  <user username="shipper" password="shipper" roles="user,hr"/>

  <user username="manager" password="manager" roles="admin,hr,manager,user,sales"/>

  <user username="tadmin" password="" roles="admin,manager"/>

  <user username="admin" password="admin" roles="admin,user,hr"/>

</tomcat-users>

                  使用这种方式来处理安全验证将不用考虑向数据库中插入组,角色,用户之类的数据,完全由Tomcat来管理

             ii、新建jbpm-console.xml文件

                  使用这种方式将需要向数据库中插入数据,由jBPM来管理安全验证,jbpm-console.xml文件内容如下:

<Context>

<Realm  className="org.apache.catalina.realm.JDBCRealm"

          driverName="com.mysql.jdbc.Driver"

          connectionURL="jdbc:mysql://localhost:3306/jbpm"

          connectionName="root"

          connectionPassword="自己的密码"

          userTable="JBPM_ID_USER u, JBPM_ID_MEMBERSHIP m, JBPM_ID_GROUP g"

          userNameCol="g.TYPE_ = 'security-role' AND m.GROUP_ = g.ID_ AND m.USER_ = u.ID_ AND u.NAME_"

          userCredCol="DISTINCT u.PASSWORD_"

          userRoleTable="JBPM_ID_USER u, JBPM_ID_MEMBERSHIP m, JBPM_ID_GROUP g"

          roleNameCol="g.NAME_" />

</Context>

                  需要向数据库中插入的数据:

      INSERT INTO JBPM_ID_GROUP VALUES(1,'G','sales','organisation',NULL);

      INSERT INTO JBPM_ID_GROUP VALUES(2,'G','admin','security-role',NULL);

      INSERT INTO JBPM_ID_GROUP VALUES(3,'G','user','security-role',NULL);

      INSERT INTO JBPM_ID_GROUP VALUES(4,'G','hr','organisation',NULL);

      INSERT INTO JBPM_ID_GROUP VALUES(5,'G','manager','security-role',NULL);

      INSERT INTO JBPM_ID_USER VALUES(1,'U','user','user@sample.domain','user');

      INSERT INTO JBPM_ID_USER VALUES(2,'U','manager','manager@sample.domain','manager');

      INSERT INTO JBPM_ID_USER VALUES(3,'U','admin','admin@sample.domain','admin');

      INSERT INTO JBPM_ID_USER VALUES(4,'U','shipper','shipper@sample.domain','shipper');

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(1,'M',NULL,NULL,2,4);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(2,'M',NULL,NULL,3,4);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(3,'M',NULL,NULL,4,4);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(4,'M',NULL,NULL,4,3);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(5,'M',NULL,NULL,1,3);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(6,'M',NULL,NULL,2,3);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(7,'M',NULL,NULL,3,3);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(8,'M',NULL,NULL,3,2);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(9,'M',NULL,NULL,2,2);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(10,'M',NULL,NULL,2,5);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(11,'M',NULL,'boss',2,1);

      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(12,'M',NULL,NULL,1,1);

             这两种方法任选一种即可。

             此时基本工作都已经做完,不过在发布前,不要忘了,将MySQL的驱动拷贝到%TOMCAT_HOME%\lib目录下,然后就可以将jbpm-console文件夹复制到%TOMCAT_HOME%\webapps目录下了,接着在bin目录下双击tomcat6.exe启动服务器,等启动过程执行完后,打开IE,输入http://localhost:8080/jbpm-console 回车,应该就能看到jbpm控制台界面了。

     

          到此,在MySQL下的布署就全部结束了,如果能看到这个界面,那恭喜你,你终于成功了!

论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics