3 Replies Latest reply on Nov 4, 2005 9:53 AM by jacekolszak

    Problems with multiple interfaces

    jacekolszak

      Hi...

      I've created simple stateless session bean:

      @Stateless
      public class Bank implements BBLocal, BSLocal {
       public void method1().....
       public void method2()......
      }
      


      and 2 interfaces to it:
      @Local
      public interface BBLocal {
       public void method1();
      }
      

      @Local
      public interface BSLocal {
       public void method2();
      }
      


      When I'm trying to lookup into BSLocal I've got : NameNotFoundException . I'm using JBoss EMbeddable. What I'm doing wrong? Does JBoss Emb. support multiple interfaces to one bean?

      Regards
      Jacek

        • 1. Re: Problems with multiple interfaces
          kabirkhan

          I'm not sure for embedded, but here's what happens in the "real" version.

          If you have two interfaces, it will bind under the name of the first one only (as returned by Class.getInterfaces()). If you want more control, you can use the @LocalBinding annotation

          • 2. Re: Problems with multiple interfaces
            kabirkhan

            ...meaning the proxy that gets bound under BBLoca limplements both BBLocal and BSLocal

            • 3. Re: Problems with multiple interfaces
              jacekolszak

              ?? Don't understand :(

              I've read the trailblazer and found that it is posible to set local interfaces in bean class using @local annotation:

              So I've created a class:

              @Local( { BBLocal.class, BSLocal.class })
              public BankBean {
              }
              


              It isn't work too. When I try to lookup into BBLocal or BSLocal I get a NameNotFoundException. But when I put only one interface in @local annotations its works.:

              @Local( { BBLocal.class } )
              public BankBean {
              }
              


              Regards
              Jacek