2 Replies Latest reply on Dec 18, 2008 10:38 AM by freddolittle

    The infamous SocketTimeoutException

    freddolittle

      Hi All,

      I am having a client connection problem. I am using JBoss 5.0 implementing JDK 6. I have sucessfuly deployed my test Stateful bean and here is the output from the URL:http://localhost:8080/jmx-console/ (after selecting service=JNDIView from the jboss section AND pressing 'Invoke' from the list operation):

      java: Namespace

      +- UserTransactionSessionFactory (proxy: $Proxy125 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
      +- TS_AppClient1
      | +- UserTransaction[link -> UserTransaction]
      | +- metaData
      | +- env
      | | +- testserver
      | | | +- HelloStatefulBean[link -> HelloStatefulBean]
      | +- classPathEntries

      Now when I use my standalone client, to access this Stateful bean, I continue to get the following stack trace:
      Before silly 1:
      javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1507)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1636)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:636)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
      at testclient.Main.main(Main.java:32)
      Caused by: java.net.SocketTimeoutException: Receive timed out
      at java.net.PlainDatagramSocketImpl.receive0(Native Method)
      at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
      at java.net.DatagramSocket.receive(DatagramSocket.java:712)
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1477)
      ... 5 more

      Here is the client code:

      public class Main
      {
      public static void main(String[] args)
      {
      InitialContext ctx = null;
      HelloStatefulRemoteInterface silly;
      Object array[] = new Object[1];
      Properties prop = new Properties();

      try
      {
      prop.setProperty("j2ee.clientName", "TS_AppClient1");
      ctx = new InitialContext(prop);
      System.out.println("Before silly 1:"+ctx.getNameInNamespace());
      Context enc = (Context) ctx.lookup("HelloStatefulBean");
      System.out.println("Before silly 2:"+enc.getNameInNamespace());
      }
      catch (NamingException e)
      {
      e.printStackTrace();
      System.out.println(e.toString(true));
      }
      }
      }

      Also, my jndi.properties file has the following key/values:
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      Here is my jboss-client.xml:
      <jboss-client>
      <jndi-name>TS_AppClient1</jndi-name>
      <ejb-ref>
      <ejb-ref-name>testserver/HelloStatefulBean</ejb-ref-name>
      <jndi-name>HelloStatefulBean</jndi-name>
      </ejb-ref>
      </jboss-client>

      I have tried doing the lookup with the text from the 'ejb-ref-name' with no success...

      Anybody have any thoughts?

      Thanks,
      Jerry

        • 1. Re: The infamous SocketTimeoutException
          jaikiran

          How do you start the JBoss server? Do you use the -b option? If yes, what value do you specify? And also where is this client located? Is it on the same system as the server or is it on a different system?

          Finally, please post the entire console logs when you start the JBoss server.

          While posting logs or xml content or code, remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure your post is correctly formatted.

          • 2. Re: The infamous SocketTimeoutException
            freddolittle

            Jaikiran,

            I am using the default JBoss server, and thus using the run.bat within the bin directory. Consequently I am not using the -b command line option. I am currently thinking that we will not connect to the server using servlets. JSP, etc. just Java remote clients.

            I am running the JBoss server on the same Windows XP (Professional Build Pack 3 Build 2600) PC that the client is running.

            I have attached both the server log and the output from the \bin\run.bat
            startup file.

            I truly appreciate your help,
            Thanks,
            Jerry

            Here is the server log: