9 Replies Latest reply on Jun 15, 2011 11:33 AM by stellina_rosa

    workItem definition doesn't work

    stellina_rosa

      Hi!

      10 days ago I created 2 work items with these steps:

      1) I create the file .conf

      2) I registered the work item in the drools.rulebase.conf file

      3) I create the class myWorkItemHandler who implements WorkItemHandler

      4) I registered it in the processTest.java class:  ksession.getWorkItemManager().registerWorkItemHandler("myWork", new MYWorkWorkItemHandler());

      5) I re-start the server and the new workItem was avaible!

       

      Today I tried to create another workItem with the same steps but it doesn't work!! I restart the server , Eclipse and the pc maybe 100 times

      I'm becoming crazy.... any idea??

      thank you very much!

        • 1. Re: workItem definition doesn't work
          salaboy21

          sounds like a typo to me.

          Check the package names and the class names and if you are deploying those classes in the right path.

          Greetings.

          • 2. Re: workItem definition doesn't work
            stellina_rosa

            the new classes are stored in the same packages where are stored the old class that refers at workItem. I don't understand...... I tried to change the old workItem(adding a new parameter in the configuration) but when I restart it doesn't change!!! :((((((

            • 3. Re: workItem definition doesn't work
              salaboy21

              Hmm.. where are you placing the packages?

              What are you doing exactly? Are you seeing an error?

              • 4. Re: workItem definition doesn't work
                stellina_rosa

                no error.

                these are my packages:

                1)src/main/java - com.sample : here there are the ProcessTest.java class and myClassWorkItemHandler.java (where there are the metod abort and executeWorkItem);

                2)src/main/resource - META-INF: here there are the .conf file and the drools.rulebase.conf file

                 

                I repeat, last week I haven't any problem with new workItem...

                • 5. Re: workItem definition doesn't work
                  stellina_rosa

                  Hi... I'm trying to create the work item "notification" explained in the guide... but it doesn't work... in the editor there isn't the new node!!!

                  I can't understand... please help me...!!!!

                  • 6. Re: workItem definition doesn't work
                    melc

                    Hello, I would advise to post all your data from all files here (attach them if you want) and also any exceptions that you might be getting.

                    • 7. Re: workItem definition doesn't work
                      stellina_rosa

                      Hello Chris..! thank you for your answer... !

                      ok, i'll post you my files..

                       

                      In the ProcessTest.java class there is the registration of others workItem: LancioDLVWorkItem e TrasformaInOggettiWorkItem works.... the other NO!!

                      I'll post you the Notification workItem (the code is the same of the tutorial...) and it doesn't work.

                      I haven't any error/exception... very strange behavior!

                      ps. .conf files are in the folder META-INF in resource, .java class are in src/main/java

                       

                      THANK YOU

                      • 8. Re: workItem definition doesn't work
                        melc

                        Hello,

                        Well, after a first scan of your files i noticed in file MyWorkDefinitions.conf a comma after "displayName":"Notification" which i think it shouldn't be there (but i don't think tha'ts the problem.... )

                         

                        In drools.rulebase.conf which conf file actually works? is it LancioDLVWorkDefinitions.conf or TrasformaInOggettiWorkDefinitions.conf? Which workitemhandlers work? What if you change the order of the conf files and place the MyWorkDefinitions.conf first? are you certain that it does not go in the executeWorkItem method of NotificationWorkItemHandler ?

                         

                        Regarding the registration of handlers everything looks fine. However another way also works by using the conf file specified in drools.session.conf (check out the META-INF folder of jbpm-gwt-console-server.war).

                        For example you can place a drools.session.conf file in your META-INF having the following line,

                        drools.workItemHandlers = CustomWorkItemHandlers.conf

                         

                        and then put at the same place a CustomWorkItemHandlers.conf file with the following line,

                        [

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

                          "Notification": new com.sample.NotificationWorkItemHandler(),

                        ]

                         

                        also don't ommit the files that you already have i.e. drools.rulebase.conf and MyWorkDefinitions.conf

                        after that no need for registration of your handlers in your code, they should work right away.

                        • 9. Re: workItem definition doesn't work
                          stellina_rosa

                          Hi Chris!

                          in drools.rulebase.conf works only LancioDLVWorkDefinitions.conf and TrasformaInOggettiWorkDefinitions.conf.

                          I can't understand why these two work items works fine and the other (that I created at the same way) doesn't work......