1 Reply Latest reply on Sep 16, 2008 2:30 AM by ron_sigal

    Pure RMI

      Hi,

      I'm trying to expose some methods using "Pure RMI" on jBoss 4.0.5GA.

      When I say "Pure RMI" this means that my interface extends the java.rmi.Remote class.

      Note that I'm not talking about a remote connection to an Statefull\stateless session Facade (EJB), which are also a type of RMI.

      My questions are:
      1. Where can I find a document describing how to do it on jBoss.

      2. How can I solve the "anonymous port selection" assuming my application will be installed behind a firewall? Is replacing the transport layer to an HTTP transport layer should work? if yes, how exectly this can be done o jBoss?

      3. If I execute the java.rmi.registry.LocateRegistry.createRegistry method upon server startup, and try to bind this RMI for the defual port (1099), I get an error saying that this port is already bind. This may hint that this is not the correct way to implement RMI. What is the correct way?

      Thanks
      Guy Hudara

        • 1. Re: Pure RMI
          ron_sigal

           

          "hudara" wrote:

          1. Where can I find a document describing how to do it on jBoss.


          Given that you are talking about pure java RMI, instead of a JBoss facility such as JBossRemoting, I doubt that there is any document specifically about your situation. I could be wrong ...

          "hudara" wrote:

          2. How can I solve the "anonymous port selection"


          Use

           public static Remote exportObject(Remote obj, int port)
           throws RemoteException
          


          or

           public static Remote exportObject(Remote obj, int port,
           RMIClientSocketFactory csf,
           RMIServerSocketFactory ssf)
           throws RemoteException
          


          in java.rmi.server.UnicastRemoteObject.


          "hudara" wrote:

          3. If I execute the java.rmi.registry.LocateRegistry.createRegistry method upon server startup, and try to bind this RMI for the defual port (1099), I get an error saying that this port is already bind.


          In Remoting we do this:

           try
           {
           log.debug("Creating registry for " + port);
          
           registry = LocateRegistry.createRegistry(port);
           }
           catch(ExportException exportEx)
           {
           log.debug("Locating registry for " + port);
          
           // Probably means that the registry already exists, so just get it.
           registry = LocateRegistry.getRegistry(port);
           }