2 Replies Latest reply on Oct 20, 2011 2:23 AM by ahemaraj

    jBPM - implementing external User Management like LDAP

    ahemaraj

      Hi,

      I am new to JBPM and I am using JBPM 5.1 for building an Application for Workflow. I am trying to use my own User Management like LDAP for the application. For that, I have downloaded SNAPSHOT of jBPM human-task 5.2 module (jbpm-human-task-5.2.0-20111010.064239-423.jar) and I have implemented Interface UserGroupCallback and I have also set the System property "jbpm.usergroup.callback" with the Implemented class.

       

      However, I was not able to assign a user/human task to non-existing user in jBPM server (i.e., I was trying to assign a task to user who existing in LDAP but not in jBPM). I got the following error in jBPM server:

       

           [java] org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

           [java]           at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)

           [java]           at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)

           [java]           at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)

           [java]           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)

           [java]           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)

           [java]           at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)

           [java]           at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)

           [java]           at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)

           [java]           at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)

           [java]           at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)

           [java]           at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)

           [java]           at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:866)

           [java]           at org.jbpm.task.service.TaskServiceSession.addTask(TaskServiceSession.java:148)

           [java]           at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:109)

           [java]           at org.jbpm.task.service.mina.MinaTaskServerHandler.messageReceived(MinaTaskServerHandler.java:41)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

           [java]           at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)

           [java]           at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

           [java]           at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:176)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

           [java]           at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

           [java]           at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)

           [java]           at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)

           [java]           at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)

           [java]           at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)

           [java]           at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)

           [java]           at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)

           [java]           at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

           [java]           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

           [java]           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

           [java]           at java.lang.Thread.run(Thread.java:662)

           [java] Caused by: org.h2.jdbc.JdbcBatchUpdateException: Referential integrity constraint violation: "FK27A9A59E619A0: PUBLIC.TASK FOREIGN KEY(CREATEDBY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

           [java] update Task set allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processId=?, processInstanceId=?, processSessionId=?, skipable=?, status=?, workItemId=? where id=? [23002-124]

       

      I am using Java 1.6 and OS is Ubuntu 10.10. Could someone please tell me what I am missing here? Do I need to wait for stable version of jBPM 5.2 for implementing my own User Management like LDAP?

       

      Any help is much appreciated.

       

      Thanks,

       

      Hemaraj

        • 1. Re: jBPM - implementing external User Management like LDAP
          tsurdilovic

          Hi Hemaraj, we are currently finishing the integration of UserGroupCallback with the console and will then update the docs and examples. I suspect that the issue you are having might be with not adding the "Administrator" user which human-task module needs. If you could provide a simple example of your impl that is failing, will use it as well during testing.

           

          Thanks.

          • 2. Re: jBPM - implementing external User Management like LDAP
            ahemaraj

            Hi Tihomir,

             

            Thanks for the quick response! I have already added "Administrator" user [User('Administrator')] in TaskServiceSession before starting MinaTaskServer. Please let me know if I need to add "Administrator" user anywhere else. Please find below the UserGroupCallback implementation class:

             

            public class UserGroupCallbackImpl implements UserGroupCallback {

                 @Autowired

                 private LdapUserDao ldapUserDao;

                 @Autowired

                private LdapGroupDao ldapGroupDao;

             

                @Override

                public boolean existsUser(String userId) {

                    return ldapUserDao.checkUser(String userId);

                }

               

                @Override

                public boolean existsGroup(String groupId) {

                    return ldapGroupDao.checkGroup(String groupId);

                }

               

                @Override

                public List<String> getGroupsForUser(String userId) {

                    return new ldapUserDao.getGroupsForUser(String userId);

                }

            }

             

            Please note I have also set System property "jbpm.usergroup.callback" before starting a process:

             

            System.setProperty("jbpm.usergroup.callback", "com.workflow.engine.UserGroupCallbackImpl");

             

            Please advice.

             

            Thanks,

             

            Hemaraj