6 Replies Latest reply on Nov 10, 2003 7:25 AM by u268

    very urgent! javax.naming.CommunicationException:Receive tim

    rupasrivi

      I am testing an ejb client from windows machine 144.0.7.102 on Lan and the jboss server is on a linux machine 144.0.121.253.
      I got javax.naming.CommunicationException:Receive timed out .Root Exception:java.net.SocketTimeOut exception.
      To remove this i increased the SocketTimeout attribute value in the jboss-service.xml file.
      This worked then i got the exception
      java.rmi.ConnectException:Connection refused to host :127.0.0.1
      For this i edited the /etc/hosts file
      to have
      -D:java.rmi.server.hostname=144.0.121.253

      Then again i m getting
      javax.naming.CommunicationExceptioon:Receive timed out
      Root Exception :SocketTimeout

      please help it urgent
      thanks

        • 1. Re: very urgent! javax.naming.CommunicationException:Receive
          darranl

          The format of the /etc/hosts file should be

          IP_address canonical_hostname aliases

          The -D:java.rmi.server.hostname=144.0.121.253 that you have specified is a command line argument that you would pass to the JVM when starting JBoss.

          • 2. Re: very urgent! javax.naming.CommunicationException:Receive
            u268

            1) the command line option for java must look like this:
            -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx

            No ':' such symbols!!! like in your string
            -D:java.rmi.server.hostname=144.0.121.253


            2) I found that windows sometimes blocks port 1099, don't know excatly how this happens, but I always change this port number in jBoss to 11099 ;)

            • 3. Re: very urgent! javax.naming.CommunicationException:Receive
              rupasrivi

              Thanks, for ur precious help.
              -Djava.rmi.server.hostname=144.0.121.253 worked.

              Now when i test the client it gives foll message:
              javax.naming.NameNotFoundException: helloworld.HelloWorld not bound

              my ejb-jar.xml in the Meta-inf dir is:

              <ejb-name>helloworld.HelloWorld</ejb-name>
              helloworld.HelloWorldHome
              helloworld.HelloWorld
              <ejb-class>helloworld.HelloWorldBean</ejb-class>
              <session-type>Stateless</session-type>
              <transaction-type>Bean</transaction-type>


              And the jboss.xml also is in the meta-inf dir, is as follows:

              <enterprise-beans>

              <ejb-name>helloworld.HelloWorld</ejb-name>
              <jndi-name>helloworld.HelloWorld</jndi-name>

              </enterprise-beans>
              </jboss

              Also the client code for the HelloWorldClient is:
              public static void main(String[] args)
              {
              Properties p = new Properties();
              p.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
              p.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
              p.setProperty(Context.PROVIDER_URL,"jnp://144.0.121.253:1099");
              try
              {
              Context jndiContext = new InitialContext(p);
              System.out.println("Got context");

              Object ref = jndiContext.lookup("java:helloworld.HelloWorld") ;
              System.out.println(" got reference");

              HelloWorldHome home = (HelloWorldHome)
              PortableRemoteObject.narrow(ref, HelloWorldHome.class);

              HelloWorld helloworld = home.create();

              helloworld.sayHello();
              }
              catch(Exception e)
              {
              System.out.println(e.toString());
              }
              }


              Please help i have been trying to run this client since days on jboss.
              At the final stage i am getting these exceptions.
              Its very important for me to run this client successfully on jboss.
              plz reply soon
              Thanks in advance


              • 4. Re: very urgent! javax.naming.CommunicationException:Receive
                rupasrivi

                Thanks, for ur precious help.
                -Djava.rmi.server.hostname=144.0.121.253 worked.

                Now when i test the client it gives foll message:
                javax.naming.NameNotFoundException: helloworld.HelloWorld not bound

                my ejb-jar.xml in the Meta-inf dir is:

                <ejb-name>helloworld.HelloWorld</ejb-name>
                helloworld.HelloWorldHome
                helloworld.HelloWorld
                <ejb-class>helloworld.HelloWorldBean</ejb-class>
                <session-type>Stateless</session-type>
                <transaction-type>Bean</transaction-type>


                And the jboss.xml is as follows:

                <enterprise-beans>

                <ejb-name>helloworld.HelloWorld</ejb-name>
                <jndi-name>helloworld.HelloWorld</jndi-name>

                </enterprise-beans>
                </jboss
                The jboss.xml file is also in the meta-inf dir along with ejb-jar.xml .
                The helloworld.jar is successfully deployed on the jboss server.

                Also the client code for the HelloWorldClient is:
                public static void main(String[] args)
                {
                Properties p = new Properties();
                p.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
                p.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
                p.setProperty(Context.PROVIDER_URL,"jnp://144.0.121.253:1099");
                try
                {
                Context jndiContext = new InitialContext(p);
                System.out.println("Got context");

                Object ref = jndiContext.lookup("java:helloworld.HelloWorld") ;
                System.out.println(" got reference");

                HelloWorldHome home = (HelloWorldHome)
                PortableRemoteObject.narrow(ref, HelloWorldHome.class);

                HelloWorld helloworld = home.create();

                helloworld.sayHello();
                }
                catch(Exception e)
                {
                System.out.println(e.toString());
                }
                }


                Please help i have been trying to run this client since days on jboss.
                At the final stage i am getting these exceptions.
                Its very important for me to run this client successfully on jboss.
                plz reply soon
                Thanks in advance


                • 5. Re: very urgent! javax.naming.CommunicationException:Receive
                  u268

                  check your jndi names at jboss.xml! for example:

                  <!-- jboss.xml -->



                  <!-- All bean containers use this security manager by default -->
                  <security-domain>java:/jaas/goslips</security-domain>

                  <enterprise-beans>

                  <ejb-name>ClientController</ejb-name>
                  <jndi-name>goSlips/ClientController</jndi-name>

                  </enterprise-beans>



                  -------------

                  so lookup will be done as:

                  Object objref = initial.lookup("goSlips/ClientController");
                  ClientControllerHome refHome = (ClientControllerHome) PortableRemoteObject.narrow(objref, ClientControllerHome.class);
                  clientController = refHome.create();

                  -----------------

                  try it

                  • 6. Re: very urgent! javax.naming.CommunicationException:Receive
                    u268

                    P.S. the main difference is in referencing to jndi without "java:" - it's wrong ;)