-
1. Re: javax.naming.CommunicationException: Receive timed out.
tgminc Aug 14, 2002 6:49 PM (in response to tdang)Did you ever figure this problem out?
I have the same issue and can seem to get past it!
Tom -
2. Re: javax.naming.CommunicationException: Receive timed out.
mahelak Sep 5, 2002 4:00 PM (in response to tdang)Hi,
I figured this out - at least my installation which JBoss 3.x
the following lines of code is required..
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
//get naming context
Context ctx = new InitialContext(env); -
3. Re: javax.naming.CommunicationException: Receive timed out.
tdang Sep 6, 2002 4:10 AM (in response to tdang)I really do not know if it is really the solution for this problem because my client contains lines similar to yours, and it works on another machine in a network environment:
Properties p = new Properties();
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
InitialContext context = new InitialContext(p); -
4. Re: javax.naming.CommunicationException: Receive timed out.
tdang Sep 6, 2002 4:12 AM (in response to tdang)I really do not know if it is really the solution for this problem because my client contains lines similar to yours, and it works on another machine in a network environment:
Properties p = new Properties();
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
InitialContext context = new InitialContext(p); -
5. Re: javax.naming.CommunicationException: Receive timed out.
rsuffling Sep 6, 2002 6:51 AM (in response to tdang)Sounds like you have a socket timeout. Here are the JNDI properties I've been using. The last two settings deal with socket timeout so it might be worth tryiing it out.
jndi properties
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=localhost:1099/
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
# The jnp protocol socket factory class
jnp.socketFactory=org.jnp.interfaces.TimedSocketFactory
# The TimedSocketFactory connection timeout in milliseconds(0 == blocking)
jnp.timeout=0
# The TimedSocketFactory read timeout in milliseconds(0 == blocking)
jnp.sotimeout=0 -
6. Re: javax.naming.CommunicationException: Receive timed out.
pdg Mar 5, 2004 9:18 AM (in response to tdang)Hi,
I thought this was the solution, but it isn't... :-(
The strange thing is, it happens only when i have a quite high load.. this is the situation.
I have JBoss instances in one partition (Default partition)
On these instances, I deployed a Stateful SessionBean.
When call some methods on it, it seems to work.
When I start 30 threads that call the same methods, some of them get the following exception(s) during creation of the InitialContext.
(Maybe good to know, It happens in both cases: when both servers are running AND when only one server runs)
This is how I create my InitialContext:
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, "10.0.0.57, 10.0.0.65");
// The TimedSocketFactory connection timeout in milliseconds(0 == blocking)
p.put("jnp.socketFactory","org.jnp.interfaces.TimedSocketFactory");
p.put("jnp.timeout","0");
// The TimedSocketFactory read timeout in milliseconds(0 == blocking)
p.put("jnp.sotimeout","0");
The Exceptions I get:
javax.naming.CommunicationException: Receive timed out. Root exception is java.io.InterruptedIOException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:387)
OR
javax.naming.CommunicationException: Failed to retrieve stub from server 0.0.0.0:110. Root exception is java.io.StreamCorruptedException: Caught EOFException while reading the stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:840)
at java.io.ObjectInputStream.(ObjectInputStream.java:163)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:197)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1107)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1192)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:514)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:345)
at com.vangenechten.multitier.ShoppingCartTest.lookupHome(ShoppingCartTest.java:146)
at com.vangenechten.multitier.ShoppingCartTest.testAddItems(ShoppingCartTest.java:51)
at com.vangenechten.multitier.ShoppingCartTest$1.run(ShoppingCartTest.java:101)
at java.lang.Thread.run(Thread.java:479)