5 Replies Latest reply on Oct 4, 2002 12:17 PM by benholland

    jndi lookup

    benholland

      When I try and do the ctx lookup I get the "not bound error"

      This is the ejb.jar


      <ejb-name>Interest</ejb-name>
      mvdc.ejb.session.IMyFirstHomeInterface
      mvdc.ejb.session.IMyFirstSession
      <ejb-class>mvdc.ejb.session.MyFirstSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>


      jboss.jar is


      <ejb-name>Interest</ejb-name>
      <jndi-name>Interest</jndi-name>
      <configuration-name>Default StatelessessionBean</configuration-name>


      then I do the ctx.lookup"interest" and it fails.

      The bean is deployed, I can see it in the jboss console.

      Any ideas?

        • 1. Re: jndi lookup
          joelvogt

          can you post lookup code + error trace?

          • 2. Re: jndi lookup
            benholland

            System.setProperty("java.naming.factory.initial",
            "org.jnp.interfaces.NamingContextFactory");
            System.setProperty("java.naming.provider.url",
            "localhost:1099");

            // Enclosing the whole process in a single `try' block is not an ideal way
            // to do exception handling, but I don't want to clutter the program up
            // with catch blocks
            try
            {
            // Get a naming context
            InitialContext jndiContext = new InitialContext();
            System.out.println("Got context");

            // Get a reference to the Interest Bean
            Object ref = jndiContext.lookup("Interest");
            System.out.println("Got reference");

            // Get a reference from this to the Bean's Home interface
            IMyFirstHomeInterface home = (IMyFirstHomeInterface)
            PortableRemoteObject.narrow (ref, IMyFirstHomeInterface.class);

            // Create an Interest object from the Home interface
            IMyFirstSession interest = home.create();

            • 3. Re: jndi lookup
              benholland

              thanks for any help

              • 4. Re: jndi lookup
                benholland

                I had a look through the server log and can find no mention of binding Interest to the JNDI??

                • 5. Re: jndi lookup
                  benholland

                  the problem was in the jboss.xml file