3 Replies Latest reply on May 26, 2009 9:53 AM by Kasinarayanan Gopalakrishnan

    Reg : Error Binding Process Engine In Tomcat Server

    Kasinarayanan Gopalakrishnan Newbie

      Hi All,

      I'm trying to integrate gwt-console with my web application.
      Currently i have initialised JBPM4 inside my web app and having it
      in a static field.
      PVM works independently with Oracle DB and custom config.
      Followed by it,
      I imported gwt-console and gwt-console-server war files into eclipse, deployed the projects in Tomcat Server, dependent jars are put in tomcat classpath and deployed the app in in the server.
      I have disbaled the default security with gwt-server-console app and i'm able to navigate to the gwt console using below URL
      (http://localhost:9090/gwt-console/org.jboss.bpm.console.Application/Application.html )

      I get the following exception when i try to view the processes and tasks with the console.

      The issue is GWT-Server app is not able to resolve the processengine context.
      How to bind custom JBPM config inside server console app.
      As i mentioned earlier i'm using tomcat not jboss.

      The below is the stack trace of the exception.

      org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalStateException: Failed to load org.jboss.bpm.console.server.plugin.TaskDispatcherPlugin: org.jbpm.integration.console.forms.TaskDispatcherPluginImpl
      at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:319)
      at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:230)
      at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:206)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:360)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
      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:228)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.IllegalStateException: Failed to load org.jboss.bpm.console.server.plugin.TaskDispatcherPlugin: org.jbpm.integration.console.forms.TaskDispatcherPluginImpl
      at org.jboss.bpm.console.server.util.ServiceLoader.loadFromServices(ServiceLoader.java:94)
      at org.jboss.bpm.console.server.util.ServiceLoader.loadService(ServiceLoader.java:56)
      at org.jboss.bpm.console.server.plugin.PluginMgr.load(PluginMgr.java:48)
      at org.jboss.bpm.console.server.InfoFacade.getServerStatus(InfoFacade.java:65)
      at org.jboss.bpm.console.server.InfoFacade.getServerInfo(InfoFacade.java:54)
      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.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
      at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
      at org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
      ... 19 more
      Caused by: java.lang.RuntimeException: Failed to lookup process engine
      at org.jbpm.integration.console.forms.TaskDispatcherPluginImpl.initializeProcessEngine(TaskDispatcherPluginImpl.java:247)
      at org.jbpm.integration.console.forms.TaskDispatcherPluginImpl.(TaskDispatcherPluginImpl.java:61)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at java.lang.Class.newInstance0(Class.java:355)
      at java.lang.Class.newInstance(Class.java:308)
      at org.jboss.bpm.console.server.util.ServiceLoader.loadFromServices(ServiceLoader.java:89)
      ... 33 more
      Caused by: javax.naming.NameNotFoundException: Name ProcessEngine is not bound in this Context
      at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at org.jbpm.integration.console.forms.TaskDispatcherPluginImpl.initializeProcessEngine(TaskDispatcherPluginImpl.java:243)
      ... 41 more
      May 19, 2009 6:33:13 PM org.apache.catalina.core.StandardWrapperValve invoke
      SEVERE: Servlet.service() for servlet Resteasy threw exception
      org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Failed to lookup process engine
      at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:319)
      at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:230)
      at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:206)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:360)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
      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:228)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.RuntimeException: Failed to lookup process engine
      at org.jbpm.integration.console.JBPMIntegration.initializeProcessEngine(JBPMIntegration.java:50)
      at org.jbpm.integration.console.JBPMIntegration.(JBPMIntegration.java:38)
      at org.jbpm.integration.console.TaskManagementImpl.(TaskManagementImpl.java:42)
      at org.jbpm.integration.console.ManagementFactoryImpl.createTaskManagement(ManagementFactoryImpl.java:43)
      at org.jboss.bpm.console.server.TaskListFacade.getTaskManagement(TaskListFacade.java:61)
      at org.jboss.bpm.console.server.TaskListFacade.getTasksForIdRef(TaskListFacade.java:90)
      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.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
      at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
      at org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
      ... 19 more
      Caused by: javax.naming.NameNotFoundException: Name ProcessEngine is not bound in this Context
      at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at org.jbpm.integration.console.JBPMIntegration.initializeProcessEngine(JBPMIntegration.java:46)
      ... 34 more
      May 19, 2009 6:47:02 PM org.apache.catalina.core.StandardWrapperValve invoke
      SEVERE: Servlet.service() for servlet Resteasy threw exception
      org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Failed to lookup process engine
      at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:319)
      at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:230)
      at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:206)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:360)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
      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:228)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.RuntimeException: Failed to lookup process engine
      at org.jbpm.integration.console.JBPMIntegration.initializeProcessEngine(JBPMIntegration.java:50)
      at org.jbpm.integration.console.JBPMIntegration.(JBPMIntegration.java:38)
      at org.jbpm.integration.console.ProcessManagementImpl.(ProcessManagementImpl.java:44)
      at org.jbpm.integration.console.ManagementFactoryImpl.createProcessManagement(ManagementFactoryImpl.java:37)
      at org.jboss.bpm.console.server.ProcessMgmtFacade.getProcessManagement(ProcessMgmtFacade.java:64)
      at org.jboss.bpm.console.server.ProcessMgmtFacade.getDefinitionsJSON(ProcessMgmtFacade.java:77)
      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.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
      at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
      at org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
      ... 19 more
      Caused by: javax.naming.NameNotFoundException: Name ProcessEngine is not bound in this Context
      at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at org.jbpm.integration.console.JBPMIntegration.initializeProcessEngine(JBPMIntegration.java:46)
      ... 34 more



      Anyone's help is appreciated :)

      Thanks,
      Kasi.





        • 1. Re: Reg : Error Binding Process Engine In Tomcat Server
          Heiko Braun Master

          Right, that's not yet integrated out of the box. However it shouldn't be too difficult. You'd need to create a ProcessEngine instance and bind it to tomcats JNDI in order for any other console-server component to access it.

          Take a look at [1] first, it explains how to bind Resource Factories to JNDI under tomcat. The spi module [2] already ships with Resource and Resource Factory implementations that can act as example. But you would need to replace the JBPMServiceLocator with something that works in tomcat. As a starting point see


          org.jbpm.integration.spi.ProcessEngineReference
          org.jbpm.integration.spi.ProcessEngineObjectFactory


          The later is the ResourceFactory.

          [1] http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html#Adding%20Custom%20Resource%20Factories
          [2] http://anonsvn.jboss.org/repos/jbpm/jbpm4/trunk/modules/integration/spi/


          Let me know if you have further questions.

          • 2. Re: Reg : Error Binding Process Engine In Tomcat Server
            Heiko Braun Master

            Here is the source of the ResourceFactory: http://fpaste.org/paste/12970. Line 48 would need to be replaced with a locator that works under tomcat.

            I am not sure what would be the best approach to this. Maybe a ServletContextListener that creates a singleton?

            • 3. Re: Reg : Error Binding Process Engine In Tomcat Server
              Kasinarayanan Gopalakrishnan Newbie

              Hi,

              Thanks for your reply.

              I make the below changes to create JNDI for processengine

              1. Added a separate class similar to ProcessEngineObjectFactory and modified the code the to get process engine from a static variable which i'm loaidng on start of server.

              public class ProceeEngineFactory implements ObjectFactory
              {
               public Object getObjectInstance(
               Object obj, Name name,
               Context nameCtx, Hashtable environment) throws Exception
               {
              // super.getObjectInstance(obj, name, nameCtx, environment);
               if (obj instanceof Reference) {
               Reference ref = (Reference)obj;
               if (ref.getClassName().equals(ProcessEngine.class.getName())) {
               RefAddr engineName = ref.get(ProcessEngineReference.ENGINE_NAME); // currently not used
               return JBPMUtils.getJbpmProcesEngine();
               }
               }
              
               return null;
               }
              }




              2. Made the below changes to context.xml in tomcat server conf
              <Resource name="ProcessEngine" auth="Container"
               type="org.jbpm.api.ProcessEngine"
               factory="ct.fw.pf.util.ProceeEngineFactory"/>


              3. Made the below changes to web.xml of GWT-Console-Server app

              <resource-env-ref>
               <description>
               Object factory for MyBean instances.
               </description>
               <resource-env-ref-name>
               ProcessEngine
               </resource-env-ref-name>
               <resource-env-ref-type>
               org.jbpm.api.ProcessEngine
               </resource-env-ref-type>
               </resource-env-ref>


              But its not resolving the issue posted.

              When i try adding the above web.xml entry in another web app running in the same server and access processengine using the code below

              InitialContext initCtx = new InitialContext();
               Context envCtx = (Context) initCtx.lookup("java:comp/env");
               ProcessEngine bean = (ProcessEngine) envCtx.lookup("ProcessEngine");



              I get the following error
              
              javax.naming.NamingException: Cannot create resource instance
               at org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceEnvFactory.java:114)
               at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
               at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
               at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
               at ct.fw.web.query.ajax.AjaxQueryBuilderPage.setup(AjaxQueryBuilderPage.java:71)
               at ct.fw.web.query.ajax.EntryPointAjaxQueryBuilderAction.setup(EntryPointAjaxQueryBuilderAction.java:48)
               at ct.fw.struts.extension.SmartAction.executeSetup(SmartAction.java:248)
               at ct.fw.struts.extension.SmartAction.execute(SmartAction.java:110)
               at ct.fw.struts.extension.RelaxServlet.doPost(RelaxServlet.java:112)
               at ct.fw.struts.extension.RelaxServlet.doGet(RelaxServlet.java:67)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
               at java.lang.Thread.run(Thread.java:619)


              Any hint on this?

              Thanks,
              Kasi