14 Replies Latest reply on Aug 23, 2011 4:15 AM by Renzo Tomaselli

    new work item definition: email connection

    Renzo Tomaselli Novice

      Hi Tihomir,

      your video "Develop complex jBPM processes ..." is well suitable for general questions about the designer and the underlying architecture.

      In this video you create a new custom workitem for mailing purposes, down to console real execution.

      A first (trivial) question concerns the connection with real email technolgy, which should be managed by a EmailWorkItemHandler somewhere.

      I miss this link from the video. The shown custom workitem might be suitable for many other usages.

      However it works: where is the trick ?

        • 1. Re: new work item definition: email connection
          Renzo Tomaselli Novice

          Another question concerns how to save generated forms into Other assets. From the video this seems to occur automatically, however in v. 1.0.0.0.54 it doesn't happen: forms are created but not added to Other assets. No errors.

          • 2. Re: new work item definition: email connection
            Tihomir Surdilovic Master

            Hi Renzo, in the video you mentioned we are using the jBPM installer as described in docs http://docs.jboss.org/jbpm/v5.1/userguide/ch03.html.

            As also described in docs (http://docs.jboss.org/jbpm/v5.1/userguide/ch13.html) each workitem needs to have a workitem handler class which gets to do the actual work and is delegated to by the process engine.

            So the only "trick" that was not shown in the video was the configuration of the Email workitem handler which happens in

            $jbpm-installer-dir/conf/META-INF

            there you will see a CustomWorkItemHandlers.conf file which you need to edit and add the workitem handler class for the Email workitem, for example:

             

            [

              "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),

              "Email": new org.jbpm.process.workitem.email.EmailWorkItemHandler("MySMTPHost","MySMTPPort","MyUsername","MyPassword"),

            ]

             

            Since org.jbpm.process.workitem.email.EmailWorkItemHandler is already available in the distro and is on the classpath at runtime, you do not need to write any code. For other workitem handlers, you would need to add the configuration in CustomWorkItemHandlers.conf as well as place a jar with your handler impl class(es) on the classpath so they can be found.

            After any changes to $jbpm-installer-dir/conf/META-INF/CustomWorkItemHandler.conf you need to run in $jbpm_console_dir:

            ant clean.demo

            ant install.demo

            ant start.demo

            so that your configuration changes get copied to the right locations.

             

            Hope this helps.

            1 of 1 people found this helpful
            • 3. Re: new work item definition: email connection
              Tihomir Surdilovic Master

              In Designer when you create an image of your process (png) or create the process and task form ftl templates, Designer attempts to also store them to Guvnor. Please check your server logs again, even if no exception is thrown there should be some indication of possible failure to connect to Guvnor.

              To connect to Guvnor, Designer uses default options provided in $designer.war/profiles/jbpm.xml. Bottom of this file contains:

               

              <externalloadurl protocol="http" host="localhost:8080" subdomain="drools-guvnor/org.drools.guvnor.Guvnor/oryxeditor" usr="admin" pwd="admin"/>

               

              If you are running guvnor on a different host, port or subdomain, or have auth configured and changed the admin user password for example, you would need to reflect those changes in this xml file (which means you need to deploy designer as an exploded war in jboss as).

               

              One more way I can think of to check what is going on in your situation is to use an FF addon like HttpFox and look at all outgoing http connections from Designer to Guvnor, and see what the response codes are..this could also reveal any problems.

               

              Hope this helps.

              • 4. Re: new work item definition: email connection
                Renzo Tomaselli Novice

                Hi Tihomir, back from holidays:

                 

                >> In Designer when you create an image of your process (png) or create the process and task form ftl templates, Designer attempts to also store them to Guvnor. Please check your server logs again, even if no exception is thrown there should be some indication of possible failure to connect to Guvnor. <<

                 

                No errors in server.log. Last entries - after generating forms - are:

                 

                2011-08-22 13:40:05,171 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-6) INFO  22-08 13:40:05,170 (NilAuthenticator.java:authenticate:35) All users are guests.
                2011-08-22 13:40:05,198 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-6) INFO  22-08 13:40:05,198 (NilAuthenticator.java:authenticate:35) All users are guests.
                2011-08-22 13:40:05,227 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-6) INFO  22-08 13:40:05,227 (NilAuthenticator.java:authenticate:35) All users are guests

                 

                2011-08-22 13:40:06,428 INFO  [com.intalio.web.server.TaskFormsServlet] (http-localhost%2F127.0.0.1-8080-1) check connection response code: 204

                2011-08-22 13:40:06,433 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-6) INFO  22-08 13:40:06,432 (NilAuthenticator.java:authenticate:35)      All users are guests.

                2011-08-22 13:40:06,436 INFO  [com.intalio.web.server.TaskFormsServlet] (http-localhost%2F127.0.0.1-8080-1) create connection response code: 405

                • 5. Re: new work item definition: email connection
                  Tihomir Surdilovic Master

                  Last line

                  create connection response code: 405

                  does not look good. I need more info from you like what exact guvnor and designer versions you are using, as well as the host and port numbers you are running guvnor on. Also if you have Guvnor jaas auth and/or rolebased auth turned on.

                  • 6. Re: new work item definition: email connection
                    Renzo Tomaselli Novice

                    Installation was fully standard (jbpm-installer from jbpm-5.1.0.Final-bin.zip), except for the designer, which is your unofficial designer-1.0.0.054-jboss.war to enable saving expression language setting.

                    DroolsGuvnor is reached as http://localhost:8080/drools-guvnor. Default login is guest.

                     

                    >> Also if you have Guvnor jaas auth and/or rolebased auth turned on.<<

                     

                    No, I don't even know what they are.

                    Also I tried to generate a png. Log was:

                     

                    2011-08-22 15:22:21,939 INFO  [com.intalio.web.server.TransformerServlet] (http-localhost%2F127.0.0.1-8080-6) check connection response code: 204

                    2011-08-22 15:22:24,568 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-5) INFO  22-08 15:22:24,567 (NilAuthenticator.java:authenticate:35)      All users are guests.

                    2011-08-22 15:22:24,569 INFO  [com.intalio.web.server.TransformerServlet] (http-localhost%2F127.0.0.1-8080-6) create connection response code: 405

                     

                    Much like before, with TransformerServlet in place of TaskFormsServlet.

                    • 7. Re: new work item definition: email connection
                      Tihomir Surdilovic Master

                      Try to replace your Guvnor with 5.3.0-SNAPSHOT. To get that war, go to https://repository.jboss.org/nexus/index.html#nexus-search;quick~guvnor-distribution-wars and navigate to 5.3.0-SNAPSHOT directory, the select the first in list (guvnor-distributions-wars-5.3.0-SNAPSHOT-jboss-as-5.1.war), in the "Artifact Info" tab then click on the Download button.

                       

                      Place this war in your $jbpm_installer/lib directory and in $jbpm_installer/build.properties change

                      drools.guvnor.version=.....

                      to

                      drools.guvnor.version=5.3.0-SNAPSHOT

                       

                      and in $jbpm_installer dir run

                      ant clean.demo

                      ant install.demo

                      ant start.demo

                       

                      for the new version to be picked up. irrc there were some changes to the Guvnor REST API after the jBPM5.1 release that fixed these issues with posting new content.

                       

                      Hope this helps.

                      • 8. Re: new work item definition: email connection
                        Renzo Tomaselli Novice

                        Done. Now no more access to Guvnor, log is:

                         

                        2011-08-22 16:10:59,730 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-3) ERROR 22-08 16:10:59,729 (LoggingHelper.java:error:74) Type '[Lorg.drools.guvnor.client.configurations.Capability;' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer.For security purposes, this type will not be serialized.: instance = [Lorg.drools.guvnor.client.configurations.Capability;@69b34f89

                        2011-08-22 16:10:59,732 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/drools-guvnor].[securityService]] (http-localhost%2F127.0.0.1-8080-3) Servlet.service() for servlet securityService threw exception

                        java.lang.NullPointerException

                        at org.drools.guvnor.server.util.LoggingHelper.error(LoggingHelper.java:76)
                        at org.drools.guvnor.server.SecurityServiceServlet.doUnexpectedFailure(SecurityServiceServlet.java:55)
                        at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:67)
                        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                        at org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
                        at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:65)
                        at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
                        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.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:619)
                        • 9. Re: new work item definition: email connection
                          Tihomir Surdilovic Master

                          Damn, may be some issue with 5.3 SNAPSHOT war I am not aware of. Will try here and report. The one I build locally works fine. Worst case I can upload mine somewhere for you to use.

                          • 10. Re: new work item definition: email connection
                            Tihomir Surdilovic Master

                            Could you just try to clear your browser cache and try to open guvnor in a new tab/window?

                            • 11. Re: new work item definition: email connection
                              Renzo Tomaselli Novice

                              Aghhh ... after cleaning the cache it seems working. I noticed defaultPackage contents now in the right panel.

                              But since jBoss was reinstalled, I have the infamous heap error, so I must patch jBoss again.

                              Then I will retry and let you know.

                              • 12. Re: new work item definition: email connection
                                Renzo Tomaselli Novice

                                Now it seems working: package "Other assets" shows png images and forms. I can play with diagrams and rebuild the package.

                                 

                                But the console works no longer: it times out while refreshing the process list, although no error is logged on the server.

                                Browser says:

                                 

                                2011-08-22 19:22:48,687 [DEBUG] GET: http://localhost:8080/gwt-console-server/rs/process/definitions

                                2011-08-22 19:23:08,688 [ERROR] <ul><li>URL: 'http://localhost:8080/gwt-console-server/rs/process/definitions'

                                <li>Action: 'org.jboss.bpm.console.client.process.UpdateDefinitionsAction'

                                <li>Exception: 'class java.io.IOException'</ul>

                                Request timeout

                                java.io.IOException:

                                Request timeout


                                After insisting several times, a java heap error appears and jBoss appears blocked (I cannot even stop it).

                                Log is (there are 2 processes stored in Guvnor):

                                 

                                2011-08-22 19:21:10,642 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-6) Loading process from Guvnor: boh

                                2011-08-22 19:21:10,642 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-6) Loading process from Guvnor: BPMN2-ExclusiveSplit

                                2011-08-22 19:21:31,639 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-6) Loading process from file system: Evaluation.bpmn

                                2011-08-22 19:21:58,659 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-5) INFO  22-08 19:21:58,659 (NilAuthenticator.java:authenticate:35)      All users are guests.

                                2011-08-22 19:21:58,659 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-5) INFO  22-08 19:21:58,659 (RepositoryServlet.java:allowUser:113)      admin authenticated for rest api

                                2011-08-22 19:21:58,659 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-5) INFO  22-08 19:21:58,659 (PackageDeploymentServlet.java:execute:134)      PackageName: defaultPackage

                                2011-08-22 19:21:58,659 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-5) INFO  22-08 19:21:58,659 (PackageDeploymentServlet.java:execute:135)      PackageVersion: LATEST

                                2011-08-22 19:21:58,659 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-5) INFO  22-08 19:21:58,659 (PackageDeploymentServlet.java:execute:136)      PackageIsLatest: true

                                2011-08-22 19:22:01,170 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-5) INFO  22-08 19:22:01,170 (PackageDeploymentServlet.java:execute:137)      PackageIsSource: false

                                2011-08-22 19:22:11,107 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-4) Loading process from Guvnor: boh

                                2011-08-22 19:22:11,107 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-4) Loading process from Guvnor: BPMN2-ExclusiveSplit

                                 

                                ok until here, but console times out and it doesn't show any process.

                                Then:

                                 

                                2011-08-22 19:22:28,408 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/gwt-console-server].[Resteasy]] (http-localhost%2F127.0.0.1-8080-6) Servlet.service() for servlet Resteasy threw exception

                                org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Could not initialize stateful knowledge session: Java heap space

                                    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:717)

                                    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.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:525)

                                    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:619)

                                Caused by: java.lang.RuntimeException: Could not initialize stateful knowledge session: Java heap space

                                    at org.jbpm.integration.console.CommandDelegate.newStatefulKnowledgeSession(CommandDelegate.java:185)

                                    at org.jbpm.integration.console.CommandDelegate.getSession(CommandDelegate.java:193)

                                    at org.jbpm.integration.console.CommandDelegate.<init>(CommandDelegate.java:71)

                                    at org.jbpm.integration.console.ProcessManagement.<init>(ProcessManagement.java:35)

                                    at org.jbpm.integration.console.ManagementFactory.createProcessManagement(ManagementFactory.java:22)

                                    at org.jbpm.integration.console.ManagementFactory.createProcessManagement(ManagementFactory.java:19)

                                    at org.jboss.bpm.console.server.ProcessMgmtFacade.getProcessManagement(ProcessMgmtFacade.java:98)

                                    at org.jboss.bpm.console.server.ProcessMgmtFacade.getDefinitionsJSON(ProcessMgmtFacade.java:122)

                                    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)

                                    ... 28 more

                                Caused by: java.lang.OutOfMemoryError: Java heap space

                                • 13. Re: new work item definition: email connection
                                  Tihomir Surdilovic Master

                                  I have honestly not encountered the OOM issues so far on any of my computers (I test designer and console in same setup as what you have on 3v different machines after any change ). There is possibly something going on with the Java setup on your machine. I would honestly either try on some other machine to see if you get the same issues, or maybe try to download a new Java runtime and point to it instead. It's really hard for me to suggest anything here because I cannot reproduce it.

                                  • 14. Re: new work item definition: email connection
                                    Renzo Tomaselli Novice

                                    Just upgraded my jdk from 1.6_21 to 1.6_27 (the latest).

                                    Everything seems running fine now, even much faster than before.