1 2 Previous Next 18 Replies Latest reply on Aug 25, 2009 8:29 PM by kukeltje

    Java Activity not using Interface

    camunda

      Hi.

      The java activity in jbpm 4 uses a normal Java class, not like in jbpm 3 an Interface (ActionHandler).

      I am missing the interface a bit, even if this solution is also a nice addition. And Implementing Java-Logic in a Activity itself requires to add this special "ActionHandler" as own activity type, which is not what I want.

      It would be a good improvement to add the possibility for an handler in the java activity like in jbpm3. Or is this already planned?

      Or why not doing it?

      Thanks
      Bernd

        • 1. Re: Java Activity not using Interface
          jbarrez

          Bernd, I agree with you. The new style is nice (especially the 'var' construct to store the result), but it'll be a bit confusing for people who are used to do jbpm3.

          • 2. Re: Java Activity not using Interface
            camunda

            I think not only confusing but also not checkable by the compiler... Flexibility is nice, but I like errors being found by the compiler already!

            • 3. Re: Java Activity not using Interface
              jbarrez

              Bernd,

              I would like to see that both approaches are doable.

              After all, there isn't much compile-time checking since the handler class is declared in XML. So if you refactor it, the process def will not be updated.
              What added value do you believe the compiler has?

              Perhaps it is possible to implement some kind of semi-compile-check when the process is deployed: eg check if the handler class exists, if it can be instantiated, if the param types are correct, ...

              I really like the POJO approach: it allows to bundle business logic into a cohesive class. But I would like to see the 'old' handler, because it is easyto explain for new people.

              • 4. Re: Java Activity not using Interface
                camunda

                Supporting both ways would be my favorite as well...

                The compiler at leasts checks that the method exists and the parameters are clear. And since it is an ActionHandler it is clear what its purpose is... Personally I don't lilke too much POJOs and magic wiring, but yes, best for jBPM is to leave the choice to the users...

                • 5. Re: Java Activity not using Interface
                  tom.baeyens

                   

                  "camunda" wrote:
                  Supporting both ways would be my favorite as well...


                  that is the plan

                  • 6. Re: Java Activity not using Interface

                    when i try to get return value from the method of the class mentioned in the Java task ... i get following nullpointerException ... Have no clue how to get rid of this... I am very well able to call the method with input object and all, but for some reason i get NullPointerException on line...

                    String out = (String)executionService.getVariable(pid, "answer1");

                    And this is the exception ...

                    java.lang.NullPointerException
                    at org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:60)
                    at org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:36)
                    at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
                    at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
                    at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
                    at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
                    at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.getVariable(ExecutionServiceImpl.java:130)



                    my java task xml is ...




                    Thanks

                    • 7. Re: Java Activity not using Interface

                      When i try to get return value from the method of the class mentioned in the Java task ... i get following nullpointerException ... Have no clue how to get rid of this... I am very well able to call the method with input object and all, but for some reason i get NullPointerException on line...

                      String out = (String)executionService.getVariable(pid, "answer1");

                      And this is the exception ...

                      java.lang.NullPointerException
                      at org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:60)
                      at org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:36)
                      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
                      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
                      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
                      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
                      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.getVariable(ExecutionServiceImpl.java:130)



                      my java task xml is ...

                       <java class="com.abc.MyClass" g="173,70,175,58" method="test" var="answer" name="Retrieve Application" >
                       <arg><object expr="#{input.apre.force}"/></arg>
                      


                      Thanks


                      • 8. Re: Java Activity not using Interface

                        there was mistake in copy/paste ... I wish i could edit my posts. Anyway, here is correction for the line ...

                        String out = (String)executionService.getVariable(pid, "answer");

                        Thanks

                        • 9. Re: Java Activity not using Interface
                          kukeltje

                          wrong forum.... use the userforum

                          • 10. Re: Java Activity not using Interface
                            kukeltje

                            and totally not related topic

                            • 11. Re: Java Activity not using Interface

                              I think it is JBPM issue ... I haven't got any response in JBPM user forum either. In this case I am not able to find out what is the issue... I am sure its not my code. I can reach inside the method i am calling through jpdl but not able to get response for the var value I have mentioned in the jpdl. Please advise ...

                              • 12. Re: Java Activity not using Interface
                                tom.baeyens

                                the problem is that your execution is not existing any more when you call getvariable on it.

                                i improved the error message

                                https://jira.jboss.org/jira/browse/JBPM-2498

                                • 13. Re: Java Activity not using Interface
                                  kukeltje

                                  I was not saying it was no jbpm issue, it was not an issue for the jBPM DEV forum but for the jBPM USER forum. THe fact that you do not get a response there is no (valid) reason to try the dev forum.

                                  • 14. Re: Java Activity not using Interface

                                    Ronald, I am really sorry about posting my issue in here...

                                    Tom, would you mind if I send you an email regarding why my execution is not existing anymore and more details on this issue?

                                    Thanks

                                    1 2 Previous Next