# RMI Server will nicht starten



## MrRagga (23. Feb 2005)

Hi,
mein Server

```
package classroombookingfactory;
 
import java.rmi.*;
import java.rmi.activation.*;
import java.util.Properties;
 
public class ClassroomBookingServer {
   public static void main( String argv[ ] ) {
      System.setSecurityManager( new RMISecurityManager() );
      try {
         Properties props = new Properties();
//          props.put("java.security.policy","file:/home/jonas/Documents/Studium/Irland/ds/classroombookingfactory");
	props.put("java.security.policy","file:/home/jonas/Documents/Studium/Irland/ds/classroombookingfactory/java.security.policy");
 
         ActivationGroupDesc.CommandEnvironment ace = null;
         ActivationGroupDesc group = new ActivationGroupDesc(props,ace);
// 	 ActivationSystem system = (ActivationSystem) Naming.lookup("//:1099/java.rmi.activation.ActivationSystem");
         ActivationGroupID agid = ActivationGroup.getSystem().registerGroup(group);
         String src = "file:/home/jonas/Documents/Studium/Irland/ds/classroombookingfactory";
         MarshalledObject data = null;
 
         ActivationDesc desc = new ActivationDesc(agid,"classroombookingfactory.ClassroomBookingFactoryImpl",src,data);
         ClassroomBookingFactory stub = (ClassroomBookingFactory)Activatable.register(desc);
         System.out.println("Got the stub");
         Naming.rebind("ActivatableClassroomBooking",stub);
         System.out.println("Exported Activation");
 
      } catch ( Exception e ) {
         System.out.println( "Error: " + e.getMessage() );
         e.printStackTrace();
      }
   }
}
```

will nicht starten.
Ich bekomm folgende Fehlermeldung:
*[jonas@TuxM ds]$ java classroombookingfactory.ClassroomBookingServer -Djava.security.policy=/home/jonas/Documents/Studium/Irland/ds/classroombookingfactory/policy
Error: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
        at java.security.AccessControlContext.checkPermission(Unknown Source)
        at java.security.AccessController.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkConnect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
        at sun.rmi.server.UnicastRef.newCall(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at java.rmi.Naming.lookup(Unknown Source)
        at classroombookingfactory.ClassroomBookingServer.main(ClassroomBookingServer.java:17)
*


Bei folgender Policy File:
[jonas@TuxM ds]$ more classroombookingfactory/policy
grant {
   permission java.security.AllPermission;
};

Jemand ne Agnung wo der Fahler verstekct liegt?

VlG Jonas


----------



## foobar (23. Feb 2005)

Starte den Server doch erstmal ohne SecurityManager, um solche Probleme zu vermeiden.


----------



## MrRagga (23. Feb 2005)

Jetzt bekomm ich:
[jonas@TuxM ds]$ java classroombookingfactory.ClassroomBookingServer -Djava.security.policy=/home/jonas/Documents/Studium/Irland/ds/classroombookingfactory/policy
Error: java.rmi.activation.ActivationSystem
java.rmi.NotBoundException: java.rmi.activation.ActivationSystem
        at sun.rmi.registry.RegistryImpl.lookup(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
        at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
        at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
        at sun.rmi.transport.Transport$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Unknown Source)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
        at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
        at sun.rmi.server.UnicastRef.invoke(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at java.rmi.Naming.lookup(Unknown Source)
        at classroombookingfactory.ClassroomBookingServer.main(ClassroomBookingServer.java:17)


VlG Jonas


----------

