3 Replies Latest reply on Nov 23, 2009 12:56 PM by sebastian.s

    Can't get pooled task instance list with jbpm & seam - proba

    achimh

      Hi everyone,
      I'm new to jbpm and can't get jbpm running. First my Environment:
      - jBPM Version : 4.2, default jbpm.cfg.xml, no special libs
      - Database : MySQL
      - JDK : 6
      - Container : Jboss 5.1.0.GA + Seam 2.2.0.GA

      I use a seam project generated with seam-gen that works as long as I do not try to access anything of the jbpm stuff. After logging in with setting up a seam identity and an jbpm actor I get the following stack trace as soon as I want to access the PooledTaskInstanceList:

      22:08:37,024 INFO [JbpmConfiguration] using jbpm configuration resource 'jbpm.cfg.xml'
      22:08:37,025 DEBUG [JbpmConfiguration] loading defaults in jbpm configuration
      22:08:37,028 DEBUG [ObjectFactoryImpl] adding object info 'default.jbpm.context'
      22:08:37,028 DEBUG [ObjectFactoryImpl] adding object info 'resource.hibernate.cfg.xml'
      22:08:37,028 DEBUG [ObjectFactoryImpl] adding object info 'resource.business.calendar'
      22:08:37,028 DEBUG [ObjectFactoryImpl] adding object info 'resource.default.modules'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'resource.converter'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'resource.action.types'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'resource.node.types'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'resource.parsers'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'resource.varmapping'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'resource.mail.templates'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'jbpm.byte.block.size'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'jbpm.task.instance.factory'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'jbpm.variable.resolver'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'jbpm.mail.smtp.host'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'jbpm.mail.address.resolver'
      22:08:37,029 DEBUG [ObjectFactoryImpl] adding object info 'jbpm.mail.from.address'
      22:08:37,030 DEBUG [ObjectFactoryImpl] adding object info 'jbpm.job.executor'
      22:08:37,030 DEBUG [JbpmConfiguration] loading specific configuration...
      22:08:37,053 SEVERE [viewhandler] Error Rendering View[/home.xhtml]
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.bpm.jbpmContext
       at org.jboss.seam.Component.newInstance(Component.java:2144)
       at org.jboss.seam.Component.getInstance(Component.java:2021)
       at org.jboss.seam.Component.getInstance(Component.java:2000)
       at org.jboss.seam.Component.getInstance(Component.java:1994)
       at org.jboss.seam.Component.getInstance(Component.java:1967)
       at org.jboss.seam.Component.getInstance(Component.java:1962)
       at org.jboss.seam.bpm.ManagedJbpmContext.instance(ManagedJbpmContext.java:165)
       at org.jboss.seam.bpm.PooledTaskInstanceList.getPooledTaskInstanceList(PooledTaskInstanceList.java:37)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
       at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
       at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
       at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
       at org.jboss.seam.bpm.PooledTaskInstanceList_$$_javassist_seam_2.getPooledTaskInstanceList(PooledTaskInstanceList_$$_javassist_seam_2.java)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
       at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
       at org.jboss.seam.Component.unwrap(Component.java:2275)
       at org.jboss.seam.Component.getInstance(Component.java:2041)
       at org.jboss.seam.Component.getInstance(Component.java:1983)
       at org.jboss.seam.Component.getInstance(Component.java:1977)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
       at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:155)
       at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
       at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
       at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
       at javax.faces.component.UIData.getValue(UIData.java:609)
       at javax.faces.component.UIData.getDataModel(UIData.java:1124)
       at javax.faces.component.UIData.setRowIndex(UIData.java:451)
       at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:77)
       at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
       at javax.faces.component.UIData.encodeBegin(UIData.java:962)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
       at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
       at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:637)
      Caused by: org.jbpm.JbpmException: couldn't parse jbpm configuration from resource 'jbpm.cfg.xml'
       at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:285)
       at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:257)
       at org.jboss.seam.bpm.Jbpm.initJbpmConfiguration(Jbpm.java:110)
       at org.jboss.seam.bpm.Jbpm.getJbpmConfiguration(Jbpm.java:101)
       at org.jboss.seam.bpm.ManagedJbpmContext.create(ManagedJbpmContext.java:55)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
       at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
       at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
       at org.jboss.seam.Component.newInstance(Component.java:2132)
       ... 109 more
      Caused by: org.jbpm.JbpmException: no ObjectInfo class specified for element 'import'
       at org.jbpm.configuration.ObjectFactoryParser.parse(ObjectFactoryParser.java:139)
       at org.jbpm.configuration.ObjectFactoryParser.parseElements(ObjectFactoryParser.java:117)
       at org.jbpm.configuration.ObjectFactoryParser.parseElementsStream(ObjectFactoryParser.java:110)
       at org.jbpm.JbpmConfiguration.parseObjectFactory(JbpmConfiguration.java:317)
       at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:281)
       ... 122 more
      


      The jbpm.cfg.xml like this, all imported files are part of the jbpm.jar:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <jbpm-configuration jndi-name="java:/ProcessEngine">
       <import resource="jbpm.default.cfg.xml" />
       <import resource="jbpm.businesscalendar.cfg.xml" />
       <import resource="jbpm.tx.jta.cfg.xml" />
       <import resource="jbpm.jpdl.cfg.xml" />
       <import resource="jbpm.identity.cfg.xml" />
       <import resource="jbpm.jobexecutor.cfg.xml" />
       <import resource="jbpm.console.cfg.xml" />
      </jbpm-configuration>
      


      It plays no role if I have a process definition deployed or not (tried both) and I'm sure that the jbpm.cfg.xml is deployed at the right place, because when I use an invalid one, I get an exception telling me about it.

      The xhtml-page trying to list the tasks looks like:

       <h:dataTable value="#{pooledTaskInstanceList}" var="task">
       <h:column>
       <f:facet name="header">Id</f:facet>
       #{task.id}
       </h:column>
       <h:column>
       <f:facet name="header">Description</f:facet>
       #{task.description}
       </h:column>
       </h:dataTable>
      


      If I remove this block, I do not get an exception (because I'm not accessing anything of jbpm).

      If I use the jbpm-console I can access, start etc. the deployed processes. That's why I do not understand what I'm doing wrong and I did not find any help for "org.jbpm.JbpmException: no ObjectInfo class specified for element 'import'", so any help is appreciated!

        • 1. Re: Can't get pooled task instance list with jbpm & seam - p
          achimh

          Hi,
          I just want to give the answer by myself, because I could fix the problem in the meantime and maybe someone is running into the same problems.

          The main point for integrating jBPM 4 in Seam (2.2) seems to be that you have to ensure that jBPM 3 is not used in your application. Seam will load its jBPM3 (jbpm-jpdl.jar) component when there is a "<bpm:jbpm>" block in your components.xml - so remove it or at least uncomment it. As in jBPM3 you will have to add the jbpm.jar in your ear-root and register it as java-module in your application.xml like:

           <module>
           <ejb>jboss-seam.jar</ejb>
           </module>
          
           <module>
           <java>jbpm.jar</java>
           </module>
          


          Besides these comfiguration issues you cannot use the seam-integrated jbpm-annotations. E.g. to start a process I use this:

           // this won't work: @createProcess(key="MyProcessName")
           public String createMyProcess() {
           ProcessEngine processEngine = new Configuration().buildProcessEngine();
           processEngine.getExecutionService().startProcessInstanceByKey("MyProcessName");
           return "startedMyProcess";
           }
          


          Additionally I could not use the Actor class to inject the actor information, although I'm not sure if this might be my fault ;)
          Instead I'm using the Seam Identity credentials as actor-id and wrote an own implementation for the IdentitySession interface which handels which groups a user is a member of etc. to determine assignment decisions. To let jBPM4 use this class I had to change my jbpm.cfg.xml to:

          <jbpm-configuration>
           <import resource="jbpm.default.cfg.xml" />
           <import resource="jbpm.tx.hibernate.cfg.xml" />
           <import resource="jbpm.jpdl.cfg.xml" />
           <transaction-context>
           <object class="mypackagename.jbpm.IdentitySessionImpl" />
           </transaction-context>
           <import resource="jbpm.businesscalendar.cfg.xml" />
          
          </jbpm-configuration>


          That's my current knowledge about integrating jBPM 4 into Seam. Keep in mind that my application (and the integration) is not finished and there might be more issues to handle. But with these steps I'm able to run at least some simple business processes.

          • 2. Re: Can't get pooled task instance list with jbpm & seam - p
            achimh

            Ok, I missed the "real answer" for my thread-problem :D

            As the annotation do not work the provided seam-objects like pooledTaskInstanceList do not work either. Therefore I had to write a bean that provides this information. It could look like this:

            @Name("taskManager")
            @Stateless
            public class TaskManagerBean implements TaskManagerLocal {
            
             ...
            
             /** Stores the process engine instance. */
             private ProcessEngine processEngine = new Configuration().buildProcessEngine();
            
             /** Stores the user's identity. */
             @In
             private Identity identity;
            
             /** Stores a list of tasks that are assigned to the current user. */
             @DataModel
             private List<Task> assignedTasks;
            
             /** Stores the currently selected assigned Task. */
             @DataModelSelection(value = "assignedTasks")
             private Task assignedTask;
            
             /**
             * Stores a list of tasks that belong the groups the current user is member of and wait for an
             * assignment.
             */
             @DataModel
             private List<Task> groupTasks;
            
             /** Stores the currently selected assigned Task. */
             @DataModelSelection(value = "groupTasks")
             private Task groupTask;
            
             /**
             * Factory method to request the assigned tasks.
             */
             @Factory("assignedTasks")
             public void findAssignedTasks() {
             if (identity.isLoggedIn()) {
             assignedTasks = processEngine.getTaskService().findPersonalTasks(
             identity.getCredentials().getUsername());
             } else {
             assignedTasks = new ArrayList<Task>();
             }
             }
            
             /**
             * Factory method to request the group tasks.
             */
             @Factory("groupTasks")
             public void findGroupTasks() {
             if (identity.isLoggedIn()) {
             groupTasks = processEngine.getTaskService().findGroupTasks(
             identity.getCredentials().getUsername());
             } else {
             groupTasks = new ArrayList<Task>();
             }
             }
            
             public String assignGroupTask() {
             if (identity.isLoggedIn() && groupTask != null) {
             processEngine.getTaskService().assignTask(groupTask.getId(),
             identity.getCredentials().getUsername());
             return TASK_ASSIGNED;
             }
             return null;
             }
            }


            • 3. Re: Can't get pooled task instance list with jbpm & seam - p
              sebastian.s

              Thank you for reporting back. This is crucial to the forum and to the community since it keeps people motivated to help each other.