13 Replies Latest reply on Mar 30, 2004 10:44 AM by Scott Stark

    javax.naming.CommunicationException when calling a cluster e

    cari34 Newbie

      Hi guys,
      I have a cluster enabled session bean deployed on JBOSS.
      The bean client uses the following properties :

      table.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      table.put(Context.PROVIDER_URL, "");
      table.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

      My client has the jbossha.jar in its classpath.
      The thing is that anytime I try to get a reference of the home interface
      I got the following exception :

      javax.naming.CommunicationException: Receive timed out. Root exception is java.net.SocketTimeoutException: Receive timed out
      at java.net.PlainDatagramSocketImpl.receive(Native Method)
      at java.net.DatagramSocket.receive(DatagramSocket.java:671)
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1093)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1223)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:514)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)


      Can anybody tell me what is wrong??
      If I do not leave empty the Context.PROVIDER_URL I get the reference.
      But the JBOSS cluster specification says that the Context.PROVIDER_URL should be empty in a cluster environment.

      So, has anybody solved this problem????

      Thank you very much.
      Cari

        • 1. Re: javax.naming.CommunicationException when calling a clust
          Mike Finn Apprentice

          Where does it specifically say to leave it blank? I am not sure how that would ever work, unless you are talking about local calls.

          The EJB (remote) client needs the URL to do the initial lookup to JNDI. You should set it to a comma separated list of your HA-JNDI servers:

          node1:1100,node2:1100,node3:1100, and so on.

          • 2. Re: javax.naming.CommunicationException when calling a clust
            Adrian Brock Master

            Actually you can leave it blank (or not defined)

            The client will try to contact HAJNDI using a multicast.
            i.e. it will look for any jboss server on the network.

            The timeout messages says it couldn't find such a server
            within the configured timeout (default 5 seconds).

            Regards,
            Adrian

            • 3. Re: javax.naming.CommunicationException when calling a clust
              cari34 Newbie

              Hi Adrian,
              Thank you very much for the reply.

              How and where could I define a larger timeout??
              In the ejb-jar.xml or in the jboss.xml file???

              The strange thing is that sometimes it happens to work.
              It's a very random behaviour.

              Thank you
              Cari.

              • 4. Re: javax.naming.CommunicationException when calling a clust
                Peter Goetz Newbie

                Hi Cari,

                I think what Adrian means is, that you should add the following line to your properties:
                table.put("jnp.discoveryTimeout", "10000");

                10000 is the number of ms.

                This has been described on page 29 of the Cluster Documentation.

                I have the same problem as you have - I think, but in my configuration it doesn't change anything when I change the timeout, because the connection seems to be there - it is just the wrong address. And that's the point where I don't know what to do about it.

                But perhaps this helps you.

                Peter

                • 5. Re: javax.naming.CommunicationException when calling a clust
                  cari34 Newbie

                  Hi Peter,
                  Thank you very much for your reply.
                  I still get the same error.
                  Do you see any messages when you start one of the nodes of your cluster in the other servers???
                  Your problem could be that.
                  Your nodes are not aware of each other.
                  When you start one of the nodes you normally see messages on the other side.

                  I will try to comeover this issue.
                  If I find someting I will let know all the cluster audience.

                  Cheers
                  Cari

                  • 6. Re: javax.naming.CommunicationException when calling a clust
                    Mike Finn Apprentice

                    Are you sure the server is multicast-reachable from the client? I can't see how autodiscovery could work if it wasn't. In our net, servers are on dedicated subnets in the datacenter and clients (on different subnets) cannnot see them via multicast. So, we have to set the provider URL for the clients. I probably should have clarified that in my last post. It is generally the exception rather than the rule that multicast is supported across subnets.

                    Is is possible that this is your issue? Can client see server via multicast? Are they on the same subnet?

                    • 7. Re: javax.naming.CommunicationException when calling a clust
                      cari34 Newbie

                      I think your servers should be on the same subnet.
                      Make sure your network switch does not block the multicast IP ranges.
                      Otherwise, you should use a non multicast be changing the JavaGroup stack in your jboss-cluster.xml.

                      I didn't not test this option, but it should work.

                      Cari

                      • 8. Re: javax.naming.CommunicationException when calling a clust
                        Peter Goetz Newbie

                        Hi!

                        Thank you for your hints, but my server instances are able to see each other and give me the messages that they have found new cluster members.
                        And the client should be able to connect, too. Because if I have a server instance running no my "client" machine, everything works fine. And under certain circumstances (one server instance running on the "client" machine and starting the client for the first time after the server start) my client is able to connect to the server via multicast.

                        But any new hints and help is very appreciated.

                        Peter

                        • 9. Re: javax.naming.CommunicationException when calling a clust
                          cari34 Newbie

                          Hi Peter,

                          Are your Jboss servers located on different machines.

                          When I run two Jboss instances on the same machine, they are able to see each other by mutlicast.

                          But when I run two servers on two different machines, they don't see each other.

                          I run the javagroups testing for IP multicast and it seems to be successiful.

                          Did you have the same problem??

                          Some idea how could I make 2 different servers (on different machines) see each other??????

                          Thank you

                          Cari.

                          • 10. Re: javax.naming.CommunicationException when calling a clust
                            Peter Goetz Newbie

                            Hi Cari,

                            yes, my server instances are running on two (and more) different machines. But all of the machines and the clients, too, are located in the same subnet. The servers find each other without problems, it seems that everything works fine there.
                            And we didn't have to do anything to have these instances clustered. It worked out of the box with the all configuration.
                            Now we have an extra configuration for our clustering, but the only things we changed from the all configuration was the partition name and, on windows machines, the UDP configuraition (set loopback to true).

                            Sorry I couldn't help you!

                            Peter

                            • 11. Re: javax.naming.CommunicationException when calling a clust
                              cari34 Newbie

                              Thanks Peter.
                              I keep investigating the subject.

                              Cari

                              • 12. Re: javax.naming.CommunicationException when calling a clust
                                David Granflo Newbie

                                I am also very interested of cari34's problem. I have the same problem. I need to run my client on the same machine as one of the cluster nodes to get it working. If my client is running on a separate machine on the same sub-net i get the same exception with the error message: "Failed to connect to server 0.0.0.0:1100"

                                Have anyone identified the problem or solution?
                                /David

                                • 13. Re: javax.naming.CommunicationException when calling a clust
                                  Scott Stark Master

                                  Either pass in the default bind address on the command line using the --host argument, or set the bind address of the HANamingService in the deploy/cluster-service.xml file:

                                   <mbean code="org.jboss.ha.jndi.HANamingService"
                                   name="jboss:service=HAJNDI">
                                   <depends>jboss:service=DefaultPartition</depends>
                                   <!-- Name of the partition to which the service is linked -->
                                   <attribute name="PartitionName">DefaultPartition</attribute>
                                   <!-- bind address of HA JNDI RMI endpoint -->
                                   <attribute name="BindAddress">${jboss.bind.address}</attribute>
                                  


                                  Change BindAddress from the jboss.bind.address system property reference to the hostname or ip address on which requests should be received.