JNDI show exceptions as well:
Source code:
try {
Hashtable hashtable = new Hashtable(2);
hashtable.put (Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.rmi.registry.RegistryContextFactory");
hashtable.put (Context.PROVIDER_URL, "rmi://localhost:1099");
InitialContext ictx = new InitialContext(hashtable);
NamingEnumeration children = ictx.list("");
System.out.println(" Available RMI objects:");
int i = 0;
while (children.hasMore()) {
NameClassPair nc = (NameClassPair) children.next();
System.out.println(" - Object[" + i + "]=" + nc.getName() + "
" + nc.getClassName()); }
..... }
yields:
MyClient exception: null
javax.naming.CommunicationException [Root exception is
java.rmi.ConnectIOException: error during JRMP connection establishment; nested
exception is:
java.net.SocketException: Software caused connection abort: recv failed]
at
com.sun.jndi.rmi.registry.RegistryContext.list(RegistryContext.java:181)
at
com.sun.jndi.rmi.registry.RegistryContext.list(RegistryContext.java:186)
at javax.naming.InitialContext.list(InitialContext.java:387)
at test.rmi.simple.MyClient.main(MyClient.java:37)
if I replace
hashtable.put (Context.PROVIDER_URL, "rmi://localhost:1099");
by
hashtable.put (Context.PROVIDER_URL, "jnp://localhost:1099");
as suggested then I got:
MyClient exception: rmiURLContext: name is not an RMI URL: jnp://localhost:1099
java.lang.IllegalArgumentException: rmiURLContext: name is not an RMI URL:
jnp://localhost:1099
at
com.sun.jndi.url.rmi.rmiURLContext.getRootURLContext(rmiURLContext.java:50)
at
com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:182)
at
com.sun.jndi.url.rmi.rmiURLContextFactory.getUsingURL(rmiURLContextFactory.java:54)
at
com.sun.jndi.url.rmi.rmiURLContextFactory.getObjectInstance(rmiURLContextFactory.java:39)
at
com.sun.jndi.rmi.registry.RegistryContextFactory.URLToContext(RegistryContextFactory.java:85)
at
com.sun.jndi.rmi.registry.RegistryContextFactory.getInitialContext(RegistryContextFactory.java:52)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.(InitialContext.java:195)
at test.rmi.simple.MyClient.main(MyClient.java:30)
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3854514#3854514
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3854514
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user