6 Replies Latest reply on Sep 25, 2014 7:49 AM by John Cotsell

    JBOSS7 - Remote lookup is failing

    mou_gc Newbie

      Hi all,


      We are trying to create two RMI objects and using a helper bean binding these to the JNDI naming service of standalone container in JBOSS AS7, with reference "CLI" and "SM". Although the bind goes through fine, the lookup fails for "CLI" with the following error message -

      javax.naming.NamingException: Unable to invoke lookup, status=WAITING

               at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:98)

               at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:78)

               at org.jboss.naming.remote.client.HaRemoteNamingStore$1.operation(HaRemoteNamingStore.java:227)

               at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:114)

               at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:223)

               at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)

               at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)

               at javax.naming.InitialContext.lookup(InitialContext.java:392)


      The lookup for "SM" succeeds though. The code snippet for the lookup -

      private static Properties jndiprop = new Properties();

      jndiprop.put("java.naming.factory.initial", "org.jboss.naming.remote.client.InitialContextFactory");

      jndiprop.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

      jndiprop.put("java.naming.provider.url", "remote://" + java.net.InetAddress.getLocalHost().getHostAddress() + ":"+port);

      initialcontext = new InitialContext(jndiprop);

      o = initialcontext.lookup(lookupString);

      where lookupString takes the vales "SM" and "CLI".


      The binding is done by a helper bean deployed in the container as follows -

      private String JBOSS_CONTEXT = "java:jboss/exported";

      InitialContext ctx = new InitialContext();

      String contextStr = JBOSS_CONTEXT + "/" + context;     //context is either SM or CLI

      ctx.rebind(contextStr, object);


      Can anybody please guide on what could be the possible reason behind this exception?


      Thanks in advance.



        • 1. Re: JBOSS7 - Remote lookup is failing
          mou_gc Newbie

          Further to add to my previous mail, we tried binding the object reference in the way mentioned in https://community.jboss.org/thread/177015 -


          You don't need any of that if you are doing it in a EJB or a servlet (starting 7.1.0.CR1). Just do:


          new InitialContext().bind("java:/name", value); // just an example.


          But that also didn't help. Anyways, as the other object's lookup is working fine, so "java:/" or "java:jboss/exported" prefix may not be the root cause. Another thing we tried is putting the bindings in the standalone.xml -

          <subsystem xmlns="urn:jboss:domain:naming:1.2">


          <lookup name="java:jboss/exported/CLI" lookup="java:/CLI"/>

          <lookup name="java:jboss/exported/StatsManager" lookup="java:/StatsManager"/>



          After that we were able to see the objects in the JNDI tree


              "outcome" => "success",

              "result" => {

                  "java: contexts" => {

                      "java:" => {

                          "CLI" => {

                              "class-name" => "xxx.yyy.zzz.cli.impl.CliImpl",

                              "value" => "xxx.yyy.zzz.cli.impl.CliImpl@3a988f3b"


                          "StatsManager" => {

                              "class-name" => "xxx.yyy.zzz.sm.smimpl.SMInterfaceImpl",

                              "value" => "xxx.yyy.zzz.sm.smimpl.SMInterfaceImpl@57271b36"


          But remote lookup from the main application thread still failed with the same exception trace. Another thing is that lookup attempt from remote IP are always successful. Also lookup stub executed on the same server is also successful.


          Can anybody please give pointers to what could be going wrong here?




          • 2. Re: JBOSS7 - Remote lookup is failing
            Wolf-Dieter Fink Master

            I'm not sure whether I understand your question.

            What object do you deploy, is it a EJB?

            What is the use-case behind?

            • 3. Re: JBOSS7 - Remote lookup is failing
              mou_gc Newbie

              Hi Wolf-Dieter Fink,


              Thanks for your response. In our application, we have a mix of EJBs as well as custom RMI objects. The one that I am speaking about, for whose lookup we are having the problem, is a  non ejb remote object.


              One of the java processes constituting our application, say P1, creates the remote object instances and binds those to the JBOSS JNDI tree, under the root context as "Common", "SM" and "CLI" (it uses a bean inside the standalone container to achieve the binding). Another java process, P2, within the application environment, tries to do a lookup for these remote objects and while it gets the reference of two(Common & SM), it fails to get for the third(CLI). Both these processes P1 and P2 are external to the JBOSS container. A lookup attempt from any remote IP, for all the 3 objects, is always successful. Even in the same physical server, an independent client doing the lookups also succeeds in getting the references. It is imperative for us that the lookup by P2 succeeds, so that the client lookup part can remain common for both ejb and non-ejb objects.


              The same approach is working in JBOSS 4.2.3 for the last couple of releases. Presently, we are upgrading to JBOSS 7.1 and facing the mentioned issue for only one of the custom objects. So we want to know what could be the probable reason behind this single object's lookup failure.


              Hope I am able to explain the scenario to you. Please let me know if its still unclear.




              • 4. Re: JBOSS7 - Remote lookup is failing
                Wolf-Dieter Fink Master

                I still not understand 'RMI Objects', do you use MBeans or something like that?

                You might consider to use EJB SIngletons as a replacement of MBeans.

                • 5. Re: JBOSS7 - Remote lookup is failing
                  mou_gc Newbie

                  By RMI Objects, I meant server side objects that inherits from javax.rmi.PortableRemoteObject. The class definition is like - public class CliImpl extends PortableRemoteObject .... {}.


                  We found out the root cause of the issue, one of the jars was missing in the classpath of the lookup process P2.


                  Thanks all the same.



                  • 6. Re: JBOSS7 - Remote lookup is failing
                    John Cotsell Newbie

                    which jar was it ? having the same problem