2 Replies Latest reply on Feb 17, 2008 1:46 PM by Pete Muir

    Stateless EJB cant be invoked by POJO

    Alexander Eitner Newbie

      Hello, i have a strange problem using SEAM.

      I have a Stateless Session Bean:

      @Stateless
      @Name("ProcessStarter")
      //@JndiName("ProcessStarterBean")
      public class ProcessStarterBean implements ProcessStarter{
       ...
      
       public void startProcess(ExeWorkflowCreator creator)
       throws ExeDocFrameworkException {
      

      Which is invoked by another stateless Session Bean:
      @Stateless
      @Name("menuPrincipal")
      public class MenuPrincipalBean implements MenuPrincipal {
       @EJB ProcessStarter processStarter;
      
       public String startDemoWorkflow2() {
       System.out.println("Starte Demo Workflow 2...");
       try {
       processStarter.startProcess(new DemoWorkflow2());
       }
       catch (ExeDocFrameworkException e) {
       e.printStackTrace();
       }
       return "home";
       }
      

      This WORKS.

      But now, i want this MenuPrincipalBean to invoke a normal Java Class called "DemoWorkflow" like this:
      public String startDemoWorkflow() {
       System.out.println("Starte Demo Workflow...");
       try {
       DemoWorkflow dw = new DemoWorkflow();
       dw.startProcess(dw);
       }
      

      with DemoWorkflow being a normal Java class (no sessionbean) which inherits another normal Java class which will then do the method-invocation and the ejb-injection.

      DemoWorkflow inherits ExeWorkflowGate:
      @Name("ExeWorkflowGate")
      public class ExeWorkflowGate {
      
       @EJB ProcessStarter processStarter;
      
       public void startProcess(ExeWorkflowCreator exeWorkflowCreator)
       throws ExeDocFrameworkException {
       processStarter.startProcess(exeWorkflowCreator);
       }
      

      I found out that injection doesnt work here, because the injected beanAttribute is always NULL. Furthermore, i tried everything to invoke the EJB with a JNDI-lookup, but it always says that the Bean is not bound...

      The strange thing is that the injection from sessionBean---->sessionBean works, but normal class ----> sessionBean doesnt work.

      I also tried to let the DemoWorkflow participate in SEAM Framework by adding @Name("...") annotation...

      Anymore suggestions or explanations por favor ?

      Thx in advance