4 Replies Latest reply on Mar 7, 2013 11:27 AM by Shobhit Tyagi

    Example Mina & Human task list

    Ouadi BELMOKHTAR Newbie

      Hi jBPM developers;

       

      I'm new in jBPM development, I just read the first 7 chapters in book "jbpm5_developer_guide", and I want to build a simple console application (before using JSF web-based application) that shows the tasks list associated to an owner, using the "Evaluation.bpmn" example provided with jBPM5 installer by default.

       

      Can any one provide me a simple example to interact with Human task service using "Mina work item handler" in order to showing the task list associated to "krisv" user.

       

      Help me please.

        • 2. Re: Example Mina & Human task list
          Ouadi BELMOKHTAR Newbie

          Thank you roxy1987 it's a very useful example.

          • 3. Re: Example Mina & Human task list
            Ouadi BELMOKHTAR Newbie

            Hi roxy1987,

             

            After configuring the "webApplication2" for using MySQL, when I want to start JBoss AS 7.1.1 for deploying the web application , I have these ERRORS, and I don't know what's the problem !

             

            This is the error message :

             

             

             
            =========================================================================
            
            
            00:38:09,470 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
            00:38:09,763 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
            00:38:09,843 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
            00:38:11,268 INFO  [org.xnio] XNIO Version 3.0.3.GA
            00:38:11,288 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
            00:38:11,307 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
            00:38:11,325 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
            00:38:11,374 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
            00:38:11,389 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
            00:38:11,443 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
            00:38:11,508 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
            00:38:11,572 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
            00:38:11,573 INFO  [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
            00:38:11,607 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
            00:38:11,658 INFO  [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
            00:38:11,693 INFO  [org.jboss.as.security] (MSC service thread 1-2) JBAS013100: Current PicketBox version=4.0.7.Final
            00:38:11,755 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
            00:38:11,760 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-3) JBAS015400: Bound mail session [java:jboss/mail/Default]
            00:38:11,778 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
            00:38:11,840 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
            00:38:12,190 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-3) JBoss Web Services - Stack CXF Server 4.0.2.GA
            00:38:12,308 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
            00:38:12,983 INFO  [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on /127.0.0.1:9999
            00:38:12,984 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on /127.0.0.1:4447
            00:38:13,036 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) JBAS015012: Started FileSystemDeploymentService for directory /home/ouadi/programing_tools/servres/JBoss/jboss-as-7.1.1.Final/standalone/deployments
            00:38:13,204 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:/jBPM5_WebApp_Example_DS]
            00:38:13,212 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
            00:38:13,322 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "WebApplication2.war"
            00:38:15,668 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Class Path entry activation.jar in "/content/WebApplication2.war/WEB-INF/lib/mail-1.4.jar"  does not point to a valid jar for a Class-Path reference.
            00:38:15,810 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for org.jbpm.persistence.jpa
            00:38:15,813 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for org.jbpm.task
            
            00:38:15,828 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for org.jbpm.persistence.jpa
            00:38:16,096 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."WebApplication2.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."WebApplication2.war".INSTALL: Failed to process phase INSTALL of deployment "WebApplication2.war"
                      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_15]
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_15]
                      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_15]
            Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011446: Failed to add persistence unit service for org.jbpm.persistence.jpa
                      at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:383)
                      at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:258)
                      at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleWarDeployment(PersistenceUnitDeploymentProcessor.java:194)
                      at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:118)
                      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
                      ... 5 more
            Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.persistenceunit."WebApplication2.war#org.jbpm.persistence.jpa" is already registered
                      at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:227) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:560) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                      at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:374)
                      ... 9 more
            
            
            00:38:16,140 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "WebApplication2.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"WebApplication2.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"WebApplication2.war\".INSTALL: Failed to process phase INSTALL of deployment \"WebApplication2.war\""}}
            00:38:16,143 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
            JBAS014777:   Services which failed to start:      service jboss.deployment.unit."WebApplication2.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."WebApplication2.war".INSTALL: Failed to process phase INSTALL of deployment "WebApplication2.war"
            
            
            00:38:16,147 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"WebApplication2.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"WebApplication2.war\".INSTALL: Failed to process phase INSTALL of deployment \"WebApplication2.war\""}}}}
            00:38:16,210 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment WebApplication2.war in 64ms
            
            

             

            And this is my "persistence.xml" file :

             

             

            <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
            <persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
            http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence">
            
                      <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
                    <provider>org.hibernate.ejb.HibernatePersistence</provider>
                    <jta-data-source>java:jboss/datasources/jBPM5_WebApp_Example_DS</jta-data-source>
            
                          <class>org.drools.persistence.info.SessionInfo</class>
                    <class>org.drools.persistence.info.WorkItemInfo</class>
                    <class>org.jbpm.process.audit.ProcessInstanceLog</class>
                    <class>org.jbpm.process.audit.NodeInstanceLog</class>
                    <class>org.jbpm.process.audit.VariableInstanceLog</class>
                          <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
                    <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class> 
            
                    <class>org.jbpm.task.Task</class>
                                <class>org.jbpm.task.Comment</class>
                                <class>org.jbpm.task.Attachment</class>
                                <class>org.jbpm.task.I18NText</class>
                                <class>org.jbpm.task.SubTasksStrategy</class>
                                <class>org.jbpm.task.Deadline</class>
                                <class>org.jbpm.task.Escalation</class>
                                <class>org.jbpm.task.Reassignment</class>
                                <class>org.jbpm.task.Notification</class>
                                <class>org.jbpm.task.BooleanExpression</class>
                                <class>org.jbpm.task.User</class>
                                <class>org.jbpm.task.PeopleAssignments</class>           
                    <properties>
                        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
                        <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/DB_jBPM5_WebApp_Example" />
                        <property name="hibernate.connection.username" value="root"/>
                        <property name="hibernate.connection.password" value="pass"/>
                        <property name="hibernate.connection.autocommit" value="true"/>
                        <property name="hibernate.max_fetch_depth" value="3"/>
                        <property name="hibernate.hbm2ddl.auto" value="update" />
                        <property name="hibernate.show_sql" value="false" />
                        <!-- 
                        <property name="hibernate.transaction.manager_lookup_class" value=" org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
                        -->
                    </properties>
            
            
                </persistence-unit>
                <persistence-unit name="org.jbpm.task">
                    <provider>org.hibernate.ejb.HibernatePersistence</provider>
            
                    <class>org.jbpm.task.Attachment</class>
                    <class>org.jbpm.task.Content</class>
                    <class>org.jbpm.task.BooleanExpression</class>
                    <class>org.jbpm.task.Comment</class>
                    <class>org.jbpm.task.Deadline</class>
                    <class>org.jbpm.task.Delegation</class>
                    <class>org.jbpm.task.Escalation</class>
                    <class>org.jbpm.task.Group</class>
                    <class>org.jbpm.task.I18NText</class>
                    <class>org.jbpm.task.Notification</class>
                    <class>org.jbpm.task.EmailNotification</class>
                    <class>org.jbpm.task.EmailNotificationHeader</class>
                    <class>org.jbpm.task.PeopleAssignments</class>
                    <class>org.jbpm.task.Reassignment</class>
                    <class>org.jbpm.task.Status</class>
                    <class>org.jbpm.task.Task</class>
                    <class>org.jbpm.task.TaskData</class>
                    <class>org.jbpm.task.SubTasksStrategy</class>
                    <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
                    <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
                    <class>org.jbpm.task.User</class>
            
            
                    <class>org.drools.persistence.info.SessionInfo</class>
                    <class>org.drools.persistence.info.WorkItemInfo</class>
                          <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
                    <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
            
                    <properties>
                        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
                        <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/DB_jBPM5_WebApp_Example" />
                        <property name="hibernate.connection.username" value="root"/>
                        <property name="hibernate.connection.password" value="pass"/>
                        <property name="hibernate.connection.autocommit" value="true"/>
                        <property name="hibernate.max_fetch_depth" value="3"/>
                        <property name="hibernate.hbm2ddl.auto" value="update" />
                        <property name="hibernate.show_sql" value="false" />
                        <!-- 
                        <property name="hibernate.transaction.manager_lookup_class" value=" org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
                        -->
                    </properties>
            
                </persistence-unit>
            </persistence>
            
            
            

             

            Datasource configuration in "standalone.xml" file :

             

             

                           <datasource jta="true" jndi-name="java:/jBPM5_WebApp_Example_DS" pool-name="MySqlDS_Pool" enabled="true" use-java-context="true" use-ccm="true">
                                <connection-url>jdbc:mysql://localhost:3306/DB_jBPM5_WebApp_Example</connection-url>
                                <driver>mysqlDriver</driver>
                                <security>
                                    <user-name>root</user-name>
                                    <password></password>
                                </security>
                            </datasource>
            
            
                            <drivers>
                                <driver name="h2" module="com.h2database.h2">
                                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                                </driver>
                                <driver name="mysqlDriver" module="com.mysql">
                                    <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                                </driver>
                            </drivers>
            
            

             

             

            module.xml file :

             

             

            <module xmlns="urn:jboss:module:1.0" name="com.mysql">
               <resources>
                 <resource-root path="mysql-connector-java-5.1.23-bin.jar"/>
               </resources>
            
               <dependencies>
                  <module name="javax.api"/>
                  <module name="javax.transaction.api"/>
                </dependencies>
            </module>
            
            

             

             

            Can you help me please.

            • 4. Re: Example Mina & Human task list
              Shobhit Tyagi Master

              Hey,

               

              There seems to be a duplicate of the persistence unit.

              org.jboss.msc.service.DuplicateServiceException.

               

              Please see if the same name is being used by any other persistence unit.

               

              Also on a different note, a couple of observations :

              I see that you have commented the look up class property. Please uncomment it and change the class from websphere to jboss.

              Please remove the connection properties from the persistence unit org.jbpm.persistence.jpa, since you have defined a data source there.

               

              Regards.