2 Replies Latest reply on Jul 24, 2008 4:30 PM by mandeep sethi

    document / pointers on doing an RMI client server implementa

    mandeep sethi Newbie

      Is there any documentation for the above? I want to do is a client / server RMI implementation and deploy in JBoss. How does one substitute the rmiregistry tool?

        • 1. Re: document / pointers on doing an RMI client server implem
          mandeep sethi Newbie

          could anyone please point me to a resource/ share thoughts?

          • 2. Re: document / pointers on doing an RMI client server implem
            mandeep sethi Newbie

            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: 127.0.0.1:1099 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 127.0.0.1:1099 [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.INITIAL_CONTEXT_FACTORY,
            "org.jnp.interfaces.NamingContextFactory");
            env.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
            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.