2 Replies Latest reply on Feb 15, 2007 8:48 AM by jaikiran pai

    Newbie question on accessing Remote Bean through JNDI

    Michael Courcy Newbie

      Hi,

      I build a Calculatrice Stateless EJB3,

      
      @Stateless
      public class CalculatriceBean implements CalculatriceRemote {
      
       /** Creates a new instance of CalculatriceBean */
       public CalculatriceBean() {
       }
      
       public int additionner(int x, int y) {
       return x+y;
       }
      
      }
      


      The appication is deployed in JBOSS nicely.

      The name of my ear is EnterpriseApplication1.ear and I can't find the JNDI naming convention for getting this Bean

      Object ref = ctx.lookup("EnterpriseApplication1/Calculatrice/remote");
       CalculatriceRemote calc = (CalculatriceRemote)PortableRemoteObject.narrow(ref,CalculatriceRemote.class);
      


      does not work well it should regarding the documentation ....

      Any Hints ?


        • 1. Re: Newbie question on accessing Remote Bean through JNDI
          Michael Courcy Newbie

          Trying the trailblazer tutorial, it looks like I did few mistakes

          If I get the object locally I should run this code

          public void jspInit () {
           try {
           InitialContext ctx = new InitialContext();
           cal = (Calculatrice) ctx.lookup(
           "EJB3Trail/CalculatriceBean/local");
           } catch (Exception e) {
           e.printStackTrace ();
           }
           }
          


          This code work fine in Trailblazer, but it still fail if I try to do it in my own app.

          So I try to see the difference between my app and trailblazer and the only noticeable thing I can see so far is in jbaoss-app.xml

          <jboss-app>
          <loader-repository>
           trailblazer:app=ejb3
           </loader-repository>
          </jboss-app>
          


          loader-repository is explained nowhere and I can't understand the choice of "trailblazer".

          I really appreciate some little explanation or link on loader-repository.

          Thanks




          • 2. Re: Newbie question on accessing Remote Bean through JNDI
            jaikiran pai Master

             

            This code work fine in Trailblazer, but it still fail if I try to do it in my own app.


            Whats the exception that you are seeing? Also can you post some snippets of your code in the bean?