Object Context.lookup(String)throwing javax.naming.CommunicationException
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Dwaipayan_Mukhopadhyay
Posted On:   Thursday, November 27, 2003 02:58 AM

context.lookup(String) failing to return any object. so, in turn, casting the class can not be done using PortableRemoteObject.narrow(Object,Object). The code is... Context jndiContext = getInitialContext(); Object ref = jndiContext.lookup("ejb/QueueHomeRemote"); QueueHomeRemote home = (QueueHomeRemote)PortableRemoteObject.narrow(ref,QueueHomeRemote.class); public static Context getInitialContext() throws javax.naming.NamingException { return new InitialContext(); Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); p.put(Context.URL_P   More>>

context.lookup(String) failing to return any object.


so, in turn, casting the class can not be done using PortableRemoteObject.narrow(Object,Object).


The code is...


Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("ejb/QueueHomeRemote");
QueueHomeRemote home = (QueueHomeRemote)PortableRemoteObject.narrow(ref,QueueHomeRemote.class);


public static Context getInitialContext()
throws javax.naming.NamingException
{
return new 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, "localhost:1099");
return new javax.naming.InitialContext(p);

}


The exception is...


[java] javax.naming.CommunicationException: Receive timed out. Root except
ion is java.io.InterruptedIOException: Receive timed out
[java] at java.net.PlainDatagramSocketImpl.receive(Native Method)
[java] at java.net.DatagramSocket.receive(DatagramSocket.java:392)
[java] at org.jnp.interfaces.NamingContext.discoverServer(NamingContext
.java:1022)
[java] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:
1111)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:47
8)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:47
1)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:350)
[java] at com.titan.clients.Client_test.main(Client_test.java:21)

   <<Less
About | Sitemap | Contact