7 Replies Latest reply on Dec 6, 2005 11:29 AM by eli konky

    JNDI lookup

    radhikamehta Newbie

      hi! I have a standalone java program which tries to lookup a sessionbean deployed in jboss3.2.0 in a remote machine.
      I am using cluster configuration.
      My java code snippet is:

      Properties p = new Properties();
      p.put (Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory
      ");
      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "xxx.xxx.xxx.xxx:1100"); // HA-JNDI port.
      Context ctx = new javax.naming.InitialContext(p);
      Object ref = ctx.lookup("abc");

      My problem is that it gives a communication exception during lookup.
      The exception is::


      javax.naming.CommunicationException. Root exception is java.rmi.RemoteException
      : Service unavailable.
      at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClien
      t.java:165)
      at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java
      :203)
      at $Proxy0.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)

      Can someone please help???
      Thanx in advance
      Regards,
      Radhika Mehta

        • 1. JNDI lookup
          hilton Newbie

          hi! I have a standalone java program which tries to lookup a sessionbean deployed in jboss3.2.0 in a remote machine.
          I am using cluster configuration.
          My java code snippet is:

          Properties p = new Properties();
          p.put (Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory
          ");
          p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
          p.put(Context.PROVIDER_URL, "xxx.xxx.xxx.xxx:1100"); // HA-JNDI port.
          Context ctx = new javax.naming.InitialContext(p);
          Object ref = ctx.lookup("abc");

          My problem is that it gives a communication exception during lookup.
          The exception is::


          javax.naming.CommunicationException. Root exception is java.rmi.RemoteException
          : Service unavailable.
          at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClien
          t.java:165)
          at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java
          :203)
          at $Proxy0.lookup(Unknown Source)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
          at javax.naming.InitialContext.lookup(InitialContext.java:347)

          Can someone please help???
          Thanx in advance
          Regards,
          Radhika Mehta

          • 2. Re: JNDI lookup
            praveenkushwaha Newbie

             

            "radhikamehta" wrote:
            hi! I have a standalone java program which tries to lookup a sessionbean deployed in jboss3.2.0 in a remote machine.
            I am using cluster configuration.
            My java code snippet is:

            Properties p = new Properties();
            p.put (Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory
            ");
            p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
            p.put(Context.PROVIDER_URL, "xxx.xxx.xxx.xxx:1100"); // HA-JNDI port.
            Context ctx = new javax.naming.InitialContext(p);
            Object ref = ctx.lookup("abc");

            My problem is that it gives a communication exception during lookup.
            The exception is::


            javax.naming.CommunicationException. Root exception is java.rmi.RemoteException
            : Service unavailable.
            at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClien
            t.java:165)
            at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java
            :203)
            at $Proxy0.lookup(Unknown Source)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
            at javax.naming.InitialContext.lookup(InitialContext.java:347)

            Can someone please help???
            Thanx in advance
            Regards,
            Radhika Mehta








            hi
            can u please help me if u had solved ur problem of HA jndi look up


            praveenkushwaha@yahoo.co.in
            praveenk@brickred.com


            • 3. Re: JNDI lookup
              Peter Backx Newbie

              I'm having similar problems. Since 3.2.4 and especially in 3.2.5 HAJNDI is extremely unreliable. Sometimes it works, sometimes it doesn't. 3.2.4 is still useable for me, but 3.2.5 is so bad it's unusable for me. So after a lot of experimenting with different configurations and different jgroups versions I'm back to using 3.2.2 which works perfectly.

              I guess most of the people are using farming so they have the same deployment on all clustered pc which should work fine, since it's not JNDI, but HAJNDI that is the problem.

              If any one wants me to post config files or other specifics, feel free to ask.


              Peter

              • 4. Re: JNDI lookup
                Scott Stark Master

                Post the config, example trace level logs to a bug report on sourceforge:
                http://sourceforge.net/tracker/?group_id=22866&atid=376685

                • 5. Re: JNDI lookup
                  Dominik Drzewiecki Newbie

                   

                  "radhikamehta" wrote:
                  hi! I have a standalone java program which tries to lookup a sessionbean deployed in jboss3.2.0 in a remote machine.
                  I am using cluster configuration.
                  My java code snippet is:

                  Properties p = new Properties();
                  p.put (Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory
                  ");
                  p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
                  p.put(Context.PROVIDER_URL, "xxx.xxx.xxx.xxx:1100"); // HA-JNDI port.
                  Context ctx = new javax.naming.InitialContext(p);
                  Object ref = ctx.lookup("abc");

                  My problem is that it gives a communication exception during lookup.
                  The exception is::


                  javax.naming.CommunicationException. Root exception is java.rmi.RemoteException
                  : Service unavailable.
                  at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClien
                  t.java:165)
                  at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java
                  :203)
                  at $Proxy0.lookup(Unknown Source)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
                  at javax.naming.InitialContext.lookup(InitialContext.java:347)



                  Darn, I am getting the very same behaviour. Either I am doing something wrong or the nasty bug hasn't been fixed for quite some time. This happens in jboss 4.0.2. Here is a short description of my config.

                  As I am trying to configure HA JMS with farming I took the following steps:
                  - I bound several IP adresses to one physical interface, namely 10.0.0.1 and 10.0.0.2
                  - copied the "all" config to "m1" and striped it a bit of unused services. It launches with no problems when invoked with a command "run -c m1 -Djboss.bind.address=10.0.0.1 -Djboss.partition.name=customCluster". JMS is deployed as a singleton.
                  - copied the "m1" to "m2" and launched with a command "run -c m2 -Djboss.bind.address=10.0.0.2 -Djboss.partition.name=customCluster"; m2 joins the cluster
                  - I have written, compiled, configured and packaged a simple MDB. I deployed a jar to the farm directory of m1. The bean gets deployed on both m1 and m2 and both bind to the defined queue. I had to slightly modify hajndi-jms-ds.xml, so that the queue used by the MDB was looked up in the HAJNDI I have set java.naming.provider.url=10.0.0.1:1100 and java.naming.provider.url=10.0.0.2:1100 for m1 and m2 respectively.
                  - Now the client part. It is intended to send messages to the queue but fails during lookup of the queue and the connectionfactory (regardless of which comes first) with the following "javax.naming.CommunicationException. Root exception is java.rmi.RemoteException: Service unavailable" I cannot post the whole stack at the moment, but it looks very similar (the same method invocation path, line numbers might differ, as I use the latest jboss 4.0.2)

                  Now the funny part. When I lunch a single server "m1" or "m2" without specifying jboss.bind.address, the ha-jndi seems to bind to 0.0.0.0:1100 instead of ${jboss.bind.address):1100, and when I changed the client's java.naming.provider.url to localhost:1100, it runs like a charm!
                  I am doing something wrong, arent I? Any ideas, anybody?

                  cheers,
                  /dd

                  • 6. Re: JNDI lookup
                    Ben Wang Master

                    This topic belongs to user forum. I am moving it over there.

                    • 7. Re: JNDI lookup
                      eli konky Newbie

                      I had the same problem on 4.0.3 sp1.

                      I had one application that worked without any problems and another application that exhibited the same problem you showed here. the difference between them was a different configuration of the RMISecurityManager.

                      after removing:

                      System.setProperty("javax.net.ssl.trustStore", ...);
                      System.setProperty("javax.net.ssl.keyStore", ...); // System.setProperty("javax.net.ssl.keyStorePassword", ...);

                      and using only:

                      System.setProperty("java.security.policy","data/rmi.policy"); // rmi related configuration..
                      RMISecurityManager securityManager = new RMISecurityManager();
                      System.setSecurityManager(securityManager);

                      it worked.

                      I still have to figure out the security issues I created by removing keystore configuration though....

                      eli