Hello all,
First off thanks for your help if you are going to respond to this, i really appreciate it.
Now to my problem.
Currently have a RMI server and RMI client that work when run from the command line. I set up the java.rmi.server.codebase property to the website on the local machine, and everything works fine. But i'm trying to run the RMI server as an NT service. (Using jsrvany if it matters). I'm able to bind to the port, but when i try to rebind my remote objects i get the nasty exception below.
I was able to reproduce this behavior at the command line, but solved it by setting the java.rmi.server.codebase property. But that is currently not working as an NT service.
What i'm wondering is this: what is the root of the problem? Why does it tell me "No security manager" I thought about setting a policy file, but i couldn't figure out what was wrong. There seems to be plenty of documentation on client side policy files, but i wasn't sure what to do with a server side policy file.
If i run the rmiregistry and don't create it in the NT service, then everything works fine. I originally thought it was a classpath problem, but i have only 1 jar, and that is where both my app and stub class's come from, so i don't think that is the problem.
here's the snippet of code that causes this exception:
public RMILoader(boolean debug)
{
try
{
if(debug)
{
System.out.println("Attempting to bind to the registry");
}
Registry rmiReg = LocateRegistry.createRegistry(1099);
}
catch(RemoteException re)
{
System.err.println("RMI Registry already running");
}
try
{
//trying to load the registry
if(debug)
{
System.err.println("Attempting to bind the generic printer");
}
Naming.rebind("GenericPrinter", new GenericPrinter());
if(debug)
{
System.err.println("Attempting to bind the hello printer");
}
Naming.rebind("HelloPrinter", new HelloPrinter());
}
catch(Exception e)
{
e.printStackTrace();
}
}
and here's the exception:
Attempting to bind to the registry
Attempting to bind the generic printer
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com/aiinet/neweb/guardian/rmiservice/remoteImpl/GenericPrinter_Stub (no security manager: RMI class loader disabled
)
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com/aiinet/neweb/guardian/rmiservice/remoteImpl/GenericPrinter_Stub (no security manager: RMI class loader disabled
)
java.lang.ClassNotFoundException: com/aiinet/neweb/guardian/rmiservice/remoteImpl/GenericPrinter_Stub (no security manager: RMI class loader disabled)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at com.aiinet.neweb.guardian.rmiservice.RMILoader.<init>(RMILoader.java:48)
at com.aiinet.neweb.guardian.rmiservice.RMIService.doRMI(RMIService.java:66)
at com.aiinet.neweb.guardian.rmiservice.RMIService.main(RMIService.java:85)
thanks again!
-brett