8 Replies Latest reply on Mar 15, 2006 11:57 AM by M R

    problem with @EJB notation

    M R Newbie

      I have a stateful sessionbean and want to inject a stateless SessionBean using @EJB-injection, but at deployment I get the following exception. It seams as if I have got a problem with jndi names, but have no clue what's wrong.
      (without @EJB I can deploy).
      The error tells me already the right class - but what does it really mean ?

      Caused by: java.lang.RuntimeException: For EJB AdminCurrencyController could not find jndi binding b
      
       ased on interface only for @EJB(my.test.ContractService) not used by any EJBs
      


      here is a small code-cut from AdminCurencyController for better understanding:

      /**
       * the simple ejb3 syntax for injection ;-)
       **/
      @EJB
      protected ContractService contractService
      ===> results in deployment exception
      

      the same with lookup works fine
      
       /**
       * the not so simple syntax of the past ...
       **/
       Context context;
       try {
       context = new InitialContext();
       CurrencyService service = (CurrencyService) context.lookup("earfilename/CurrencyServiceSessionBean/local");
       } catch (NamingException e) {
       e.printStackTrace();
       }
      


      thx for help