0 Replies Latest reply on Jul 28, 2008 6:04 PM by Alex Kavo

    Problem to call an annotated method from another component

    Alex Kavo Novice

      Hallo all!


      I have a class that manages my running processes

      @Name("processManager")
      public class ProcessManagerBean implements ProcessManager{
          ...
      
          @BeginTask
          @EndTask
          public String endTask(){
           return "taskEnded";
          }
          ...
      }


      And I have another class (TestClass) that wants to use this processManager.endTask() method
      @Name("testing")
      public class TestClass {
           
           @In(value="#{processManager}")
           ProcessManager processManager;
           
           public void endCurrentTask(){
                processManager.endTask();
           }
           
      }


      First problem is that without
      (value="#{processManager}")

      my TestClass is not injected with the processManager even it is used before. I get NullPointerException.


      The main problem is that I cannot call the method processManager.endTask() in my TestClass like you can see here

      public void endCurrentTask(){
          processManager.endTask();
      }


      Then I get this error:
      task/process id may not be null"


      I thought I need the processId and the taskID to solve the problem, so I added this variables to my processManager:
         @RequestParameter("processId")
          private String processId;
      
          @RequestParameter("taskId")
          private String taskId;
          



      Hope you can help me!
      Thanks in advance.
      Axel