4 Replies Latest reply on Nov 9, 2004 10:51 AM by starksm64

    Naming.list("rmi://localhost:1099"); does not work

    thoste

      From a java client class I tried to find out all currently
      offered rmi servers (server objects) by coding:

      String[] objlist = Naming.list("rmi://localhost:1099");

      But this yields the exception shown at the bottom of this posting.
      Why?

      How do I list otherwise all objects?

      Do I have to setup JBoss for this "pure" (=not EJB) RMI usage?
      Do I have to include some special jars in the client app CLASSPATH?
      With an external rmiregistry all works fine.

      Thomas


      error during JRMP connection establishment; nested exception is:
      java.net.SocketException: Software caused connection abort: recv failed
      java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
      java.net.SocketException: Software caused connection abort: recv failed
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:274)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
      at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
      at sun.rmi.registry.RegistryImpl_Stub.list(Unknown Source)
      at java.rmi.Naming.list(Naming.java:191)
      at test.rmi.simple.MyClient.main(MyClient.java:25)
      Caused by: java.net.SocketException: Software caused connection abort: recv failed
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:129)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
      at java.io.DataInputStream.readByte(DataInputStream.java:331)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:215)
      ... 5 more

        • 1. Re: Naming.list(
          starksm64

          rmi: is not a valid jndi protocol for the jboss naming service. The string should be "jnp://localhost:1099"

          • 2. Re: Naming.list("rmi://localhost:1099"); does not work
            thoste

            Changing to "jnp" does NOT solve the problem.
            I got now the following exception:

            MyClient exception: invalid URL scheme: jnp://localhost:1099/
            java.net.MalformedURLException: invalid URL scheme: jnp://localhost:1099/
            at java.rmi.Naming.parseURL(Naming.java:233)
            at java.rmi.Naming.list(Naming.java:181)
            at test.rmi.simple.MyClient.main(MyClient.java:28)

            Yes, I put %JBOSS_HOME%/client/jnp-client.jar in the CLASSPATH.

            The full code is:

            public static void main(String[] args ) {

            // Create and install a security manager
            /*
            if (System.getSecurityManager() == null) {
            System.setSecurityManager(new RMISecurityManager()); }
            */
            try {
            String[] objlist = null;
            objlist = Naming.list("jnp://localhost:1099/");
            if (0 < objlist.length) {
            System.out.println(" Available RMI objects (after rebind) using external Registry:");
            int i = 0;
            while(i < objlist.length) {
            System.out.println(" - Object[" + i + "]="+ objlist);
            i++; } }
            } catch(......) { ... }

            • 3. Re: Naming.list(
              darranl

              What are you trying to achieve? Why aren't you using JNDI? Are you still following a tutorial for a different application server?

              • 4. Re: Naming.list(
                starksm64

                Oh, your using the rmi registry Naming.list, not the jndi Context.list as I thought. JBoss does not implement an rmi registry. Use jndi.