[jboss-user] [JNDI/Naming/Network] - Re: document / pointers on doing an RMI client server implem

maggu do-not-reply at jboss.com
Thu Jul 24 16:30:31 EDT 2008

so, if looks like I can use RMi via JNDI in JBoss.  Here is what I have tried so far, and it is not working. Do let me know what I am missing:
1) defined a client / server / interface / iterface impl according to how it's done in RMI
2) packaged with other classes in my simple JBoss app.
3)in a servlet I am invoking the initialization methods for Server first, and then Client.
4) I am using InitialContext to bind and connect in the server / client (see sample below).
5) What am I missing? 
6) Do I need an rmi policy file? any security permissions?
I keep getting the following exception:

Server exception thrown: javax.naming.CommunicationException: Could not obtain connection to any of these urls: and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out].......
[Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server [Root exception is java.net.ConnectException: Connection refused: connect]]]

a snippet of my code is:
MyClassImpl obj = new MyClassImpl();
MyClass stub = (MyClass) UnicastRemoteObject.exportObject(obj, 0);

Properties env = new Properties();
env.put(Context.PROVIDER_URL, "jnp://");
Context ctx = new InitialContext(env);
ctx.bind("MyString", stub);

the exception is thrown when binding, I have tried rebind also. I have similar code snippet for looking up the stub in client side too.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4166506#4166506

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4166506

More information about the jboss-user mailing list