7 Replies Latest reply on Aug 1, 2002 2:39 PM by Mike Monette

    local jndi name question.

    nickbuus Newbie

      Hello!
      I was wondering if I have to specify a local jndi name in jboss.xml if I want one,
      Or does jboss provide both a jndi name and a local jndi name automatically?

      thanks

      Nick

        • 1. Re: local jndi name question.
          Adrian Brock Master

          Remote = <ejb-name>
          Local = local/<ejb-name>

          Assuming you declare the interfaces in ejb-jar.xml

          Regards,
          Adrian

          • 2. Re: local jndi name question.
            bjoern Newbie

            Hi all!

            I have declared my EJB local and when deploying JBOSS tells my, the Bean was correctly bound to 'local/'.

            But when I try a lookup with
            initial.lookup("local/");
            I receive a 'NullPointer'-Exception and the jboss-Log says the bean was not bound. Looking at the JNDIView shows me the Bean at the JNDI-Global-Namespace at the local note.
            Trying ...("java:env/local/...) or ...("java:local/...) didn't solve the problem.

            Whats wrong. Do I have to do speciall property settings for the InitialContext. At the moment the Context was initialized with that:
            Properties prop = new Properties();

            prop.put InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

            prop.put(InitialContext.PROVIDER_URL, "localhost:1099");
            ctx = new InitialContext(prop);

            Every other RemoteBean or Datasource works. Means I lookup and get the beans, just the local Beans didn't work.

            Please help!!
            Thanks
            BJ

            • 3. Re: local jndi name question.
              nickbuus Newbie

              You can only make local calls from within session and entity beans. It looks like you're trying to make a local call from your client code - jsp/servlet or whatever - and that's not possible - you have to make it a remote call.

              • 4. Re: local jndi name question.
                Åsmund Hjulstad Newbie

                Not that it fixes the problem in question, but you can make local calls from servlets in an embedded container...

                Åsmund

                • 5. Re: local jndi name question.
                  bjoern Newbie

                  Hi nickbuus!

                  Thanks for helping. This was finaly the problem and after I lookup inside a sessionbean i got the searched local bean.
                  My fault was to think a local client can call local beans.

                  Thanks a lot!

                  CU
                  BJ

                  • 6. Re: local jndi name question.
                    frank starsinic Newbie

                    jboss 2.4.1 - jdk1.3.1 - win2000

                    on a related topic...

                    I am storing a string in Jndi to be looked up within jboss and from external jvm's.
                    (Nothing to do with EJBs)

                    i can do a lookup() from within jboss and from
                    an external jvm and all seem ok.

                    however, when i modify the value a la
                    Context c = new InitialContext();
                    c.rebind("this", "that");

                    i get strange results (to me, anyhow).

                    if i do the rebind() from within jboss jvm
                    and do a lookup() from within jboss jvm
                    all seems well but
                    i get the old values if i
                    do a lookup() from a different jvm.

                    and also....

                    if i do the rebind() from within a different jvm
                    and a lookup() from a different jvm
                    all seems well again but then
                    the changes are not noticed if i
                    do a lookup() from within jboss.
                    (again, i get the original values)

                    i would assume that changes in jndi would
                    get noticed, irrespective of the jvm.
                    i thought that was the idea behind jndi.

                    how do i make global changes OR what am I
                    missing?

                    thanks,

                    frank

                    • 7. Re: local jndi name question.
                      Mike Monette Newbie

                      > You can only make local calls from within session and
                      > entity beans. It looks like you're trying to make a
                      > local call from your client code - jsp/servlet or
                      > whatever - and that's not possible - you have to make
                      > it a remote call.

                      I'd like to follow up on that statement. I'm currently working on migrating an application from weblogic to jboss, and I'm running into a problem doing lookups on the local interface. The application does this fine under weblogic, but not jboss. Is this an area where weblogic is operating outside the standards?

                      -Thanks