2 Replies Latest reply on Jan 17, 2012 9:17 AM by nt2005

    jBPM5 and Seam 2.2.2 at jBoss 6 Server

    nt2005 Newbie

      Hey Guys,

       

      I still have got a problem implement jBPM5 into seam. Okay, here ist what I have done in Eclipse:

       

      Create a new project "Seam 2 Web Project" as EAR.

      Update the standard libraries with that from jBPM 5.2 Runtime:

       

      drools-core-5.3.1

      drools-compiler-5.3.1

      knowledge-api-5.3.

      org.eclipse.jdt.core

      All available libaries of jBPM 5.2.0

      and btm-2.1.2.

       

      I delete also the old libraries (that I have overwrited with the new ones).

       

      I have seam

       

       

      package org.domain.process.session;
      
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      
      import org.drools.KnowledgeBase;
      import org.drools.builder.KnowledgeBuilder;
      import org.drools.builder.KnowledgeBuilderFactory;
      import org.drools.builder.ResourceType;
      import org.drools.io.ResourceFactory;
      import org.drools.runtime.StatefulKnowledgeSession;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.log.Log;
      import org.jboss.seam.international.StatusMessages;
      import org.jboss.seam.annotations.Destroy;
      
      @Stateful
      @Name("processHandler")
      public class ProcessBean implements ProcessHandler
      {
          private static final String MARKER = "------------------------";
      
          // add additional action methods
      
          public void start() {
      
              System.out.println("Okay, lets start the process!");
      
              KnowledgeBase kbase = readKnowledgeBase();
              StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
              ksession.startProcess("com.nt.myprocess");
      
          }
      
          private KnowledgeBase readKnowledgeBase() {
              KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
              kbuilder.add(ResourceFactory.newClassPathResource("resources/process.bpmn"), ResourceType.BPMN2);
      
              return kbuilder.newKnowledgeBase();
          }
      
          @Destroy
          @Remove
          public void destroy() {}
      
      }
      

       

      When I start my JBoss 6.1.0.Final Server with this project and click on the button, which start the process #{processHandler.start()} I got following error:

       

       

      08:06:04,214 WARNUNG [javax.enterprise.resource.webcontainer.jsf.lifecycle] Could not instantiate Seam component: processHandler: org.jboss.seam.InstantiationException: Could not instantiate Seam component: processHandler
          at org.jboss.seam.Component.newInstance(Component.java:2170) [:2.2.2.Final]
          at org.jboss.seam.Component.getInstance(Component.java:2024) [:2.2.2.Final]
          at org.jboss.seam.Component.getInstance(Component.java:1986) [:2.2.2.Final]
          at org.jboss.seam.Component.getInstance(Component.java:1980) [:2.2.2.Final]
          at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55) [:2.2.2.Final]
          at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50) [:2.2.2.Final]
          at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148) [:2.2.2.Final]
          at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51) [:2.2.2.Final]
          at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173) [:1.2_15-20100816-SNAPSHOT]
          at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200) [:1.2_15-20100816-SNAPSHOT]
          at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44) [:1.0_02.CR5]
          at org.jboss.el.parser.AstValue.getTarget(AstValue.java:34) [:1.0_02.CR5]
          at org.jboss.el.parser.AstValue.invoke(AstValue.java:95) [:1.0_02.CR5]
          at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [:1.0_02.CR5]
          at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68) [:1.1.15.B1]
          at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [:1.2_15-20100816-SNAPSHOT]
          at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [:1.2_15-20100816-SNAPSHOT]
          at javax.faces.component.UICommand.broadcast(UICommand.java:387) [:1.2_15-20100816-SNAPSHOT]
          at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329) [:3.3.3.Final]
          at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304) [:3.3.3.Final]
          at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261) [:3.3.3.Final]
          at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474) [:3.3.3.Final]
          at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) [:1.2_15-20100816-SNAPSHOT]
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) [:1.2_15-20100816-SNAPSHOT]
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [:1.2_15-20100816-SNAPSHOT]
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) [:1.2_15-20100816-SNAPSHOT]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.1.0.Final]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [:2.2.2.Final]
          at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [:2.2.2.Final]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
          at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [:2.2.2.Final]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [:2.2.2.Final]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [:2.2.2.Final]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
          at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [:3.3.3.Final]
          at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [:3.3.3.Final]
          at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [:3.3.3.Final]
          at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [:3.3.3.Final]
          at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [:2.2.2.Final]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
          at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [:2.2.2.Final]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
          at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) [:2.2.2.Final]
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.2.Final]
          at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [:2.2.2.Final]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.1.0.Final]
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [:6.1.0.Final]
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.1.0.Final]
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [:6.1.0.Final]
          at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
          at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.1.0.Final]
          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.1.0.Final]
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159) [:6.1.0.Final]
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.1.0.Final]
          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0.Final]
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.1.0.Final]
          at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0.Final]
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.1.0.Final]
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.1.0.Final]
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.1.0.Final]
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.1.0.Final]
          at java.lang.Thread.run(Unknown Source) [:1.6.0_30]
      Caused by: javax.naming.NameNotFoundException: unable to find a bound object at name 'Process-ear/ProcessBean/local'
          at bitronix.tm.jndi.BitronixContext.lookup(BitronixContext.java:83) [:2.1.2]
          at javax.naming.InitialContext.lookup(Unknown Source) [:1.6.0_30]
          at org.jboss.seam.Component.instantiateSessionBean(Component.java:1403) [:2.2.2.Final]
          at org.jboss.seam.Component.instantiate(Component.java:1367) [:2.2.2.Final]
          at org.jboss.seam.Component.newInstance(Component.java:2148) [:2.2.2.Final]
          ... 67 more
      
      08:06:04,242 SCHWERWIEGEND [javax.enterprise.resource.webcontainer.jsf.lifecycle] JSF1054: (Phase ID: INVOKE_APPLICATION 5, View ID: /home.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@18ef5ced]
      

       

      The NameNotFoundException is incorrect, because it is bound:

       

      08:22:29,769 INFO  [org.jboss.seam.Component] Component: processHandler, scope: STATEFUL, type: STATEFUL_SESSION_BEAN, class: org.domain.process.session.ProcessBean, JNDI: Process-ear/ProcessBean/local
      

       

      Also when I do not use anything of jBPM5.2 in the processHandler, the error exist.

      If I remove the btm-2.1.2 library, the seam component works but than the jbpm5.2 process does not work.

       

      Why? Please can anyone help me?


        • 1. Re: jBPM5 and Seam 2.2.2 at jBoss 6 Server
          Tihomir Surdilovic Master

          Ich glaube das in Seam 2 @Stateful EJBs nicht direkt über JNDI Lookup oder dem "new" Operator instanziiert werden können. Du musst  da schon @In(create=true) benutzen oder einfach POJOs statt von EJB Komponenten mit @Scope(ScopeType.SESSION).

          1 of 1 people found this helpful
          • 2. Re: jBPM5 and Seam 2.2.2 at jBoss 6 Server
            nt2005 Newbie

            Durch das weglassen von @Stateful funktioniert es. Danke.

             

            Aber ich kann auch nicht über @In(...) ein @Stateful EJB laden/erstellen. Da kommt die gleiche Fehlermeldung.

             

            Das verrückte ist ja:

            Wenn ich die Library btm-2.1.2 nicht in meinen Projekt (und Server) hinzufüge, funktioniert der Bean einwandfrei (bis auf das, was jBPM angeht). Sobald ich aber diese hinzufüge, funktioniert ejbs @Stateless oder @Stateful nicht mehr.

             

            Ich habe keine Ahnung in wie weit  EJB auf eine andere btm-Library zugreift...