Hi Folks,

I'm hoping that some RMI guru can help
me get started.  I'm trying to create a
simple RMI client/server on a single computer,
but something is choking in the rebind() call.

linux 2.0.38
java "1.1.7B" 

in window 1:


[jape@jaguar jape]$ echo $CLASSPATH

[jape@jaguar jape]$ rmiregistry          



in window 2:


[jape@jaguar test2]$ pwd
/usr/home/jape/test2
[jape@jaguar test2]$ echo $CLASSPATH
/usr/home/jape
[jape@jaguar test2]$ ls
Jape.java             Server.java           ServerInterface.java







[jape@jaguar test2]$ cat ServerInterface.java
package test2;


import java.rmi.Remote;                      
import java.rmi.RemoteException; 



public interface ServerInterface extends Remote {

   public void testMethod( ) throws RemoteException;


}




[jape@jaguar test2]$ cat Server.java


package test2;

import java.rmi.*;
import java.rmi.server.*;       

public class Server extends UnicastRemoteObject implements
ServerInterface {


   private static final String name = "rmi://localhost/Server";



   public Server ()  throws RemoteException {
      super(); 

   }
   
   
   public void testMethod  (  ) throws RemoteException {
      System.err.println(" testmethod run ");
   }

   public static void main (String args[]) {
      try {
         System.out.println( "main");
         if ( System.getSecurityManager() == null )
             System.setSecurityManager(new RMISecurityManager());

         Server result = new Server();
         Naming.rebind( name, result );        
      } catch (RemoteException e ) {
         System.err.println("remote exception in main ");
         e.printStackTrace();
      } catch ( java.net.MalformedURLException e ) {
         System.err.println("malformed url in main ");
         e.printStackTrace();

      }
      System.out.println( "after main");
   }
}




[jape@jaguar test2]$ cat Jape.java 


package test2; 

import java.rmi.*;


public class Jape  {

   public static void main( String [] args ) {
     if ( System.getSecurityManager() == null ) 
         System.setSecurityManager( new RMISecurityManager() );
   
      try { 
         ServerInterface server = 
           (ServerInterface) 
               Naming.lookup( "rmi://localhost/Server" );

         System.out.println( "running... " );
         server.testMethod( ) ;

      } catch (Exception e ) {
          e.printStackTrace();
      }
   }

}


[jape@jaguar test2]$ rmic test2.Server
[jape@jaguar test2]$ ls
Jape.class             Server.java            Server_Skel.class
Jape.java              ServerInterface.class  Server_Stub.class
Server.class           ServerInterface.java                              

[jape@jaguar test2]$  java
-Djava.rmi.server.codebase=file:/usr/home/jape/ test2.Server

main
remote exception in main 
java.rmi.ServerException: Server RemoteException; nested exception is: 
        java.rmi.AccessException: Registry.rebind
after main




Any thoughts or pointers would be appreciated.

regards

jp


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to