J
Jun
I tried the Sun's RMI example at
http://java.sun.com/docs/books/tutorial/rmi/index.html
The server run fine with commandline
cd deployment\classes
java -classpath ".\deployment;%CLASSPATH%;"
-Djava.rmi.server.codebase=file:/c:\My_test\rmi2\deployment\classes/
-Djava.rmi.server.hostname=12.236.86.90
-Djava.security.policy=..\java.policy engine.ComputeEngine
and java.policy file as
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.io.FilePermission
"c:\\My_test\\rmi2\\deployment\\classes\\-", "read";
};
I got the exception below when trying the client with commandline
cd client_dir
java -classpath ".;compute.jar;%CLASSPATH%"
-Djava.rmi.server.codebase=file:/c:\my_test\rmi2\client_dir/
-Djava.security.policy=client.policy client.ComputePi 12.236.86.90 20
with client.policy as
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.io.FilePermission
"C:\\My_test\\rmi2\\client_dir\\-", "read";
};
I noticed that it complained the permission
"(java.io.FilePermission \c:\My_test\rmi2\deployment\classes\- read)"
which is the codebase used by the server. As you can see that
this permission is already in the java.policy used by server.
Any point about what is wrong?
thanks
============== exception when run client, ComputePi ===============
C:\My_test\rmi2\client_dir>java -classpath
".;compute.jar;.;C:\j2sdk\jre\lib
jar;C:\my_db\oracle\ora92\jdbc\lib\classes111.zip;C:\my_db\oracle\ora92\jdbc
\nls_charset11;C:\my_db\oracle\ora92\jdbc\lib\ojdbc14.jar;C:\j2sdk\lib\tools
;C:\My_try\JClass50K\lib\jcjarmasterK.jar;C:\My_try\JClass50K;C:\My_enterpri
oap-2_2/soap.jar;C:\My_enterprise\javamail-1.2\mail.jar;C:\My_enterprise\jaf
..1\activation.jar;C:\My_enterprise\soap-2_2;C:\My_enterprise\bsf-2_2\lib\bsf
;C:\My_enterprise\rhino1_5R2\js.jar"
-Djava.rmi.server.codebase=file:/c:\my_
\rmi2\client_dir/ -Djava.security.policy=client.policy
client.ComputePi 12.
86.90 20
ComputePi exception: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: access denied to class
loader
java.rmi.UnmarshalException: error unmarshalling return; nested
exception is
java.lang.ClassNotFoundException: access denied to class
loader
java.lang.ClassNotFoundException:
java.security.AccessControlException: acce
enied (java.io.FilePermission \c:\My_test\rmi2\deployment\classes\-
read)
at java.security.AccessControlContext.checkPermission(Unknown
Source
at java.security.AccessController.checkPermission(Unknown
Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.rmi.server.LoaderHandler$Loader.checkPermissions(Unknown
Sour
at sun.rmi.server.LoaderHandler$Loader.access$000(Unknown
Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveClass(Unknown
Source)
at java.ibjectInputStream.inputClassDescriptor(Unknown
Source)
at java.ibjectInputStream.readObject(Unknown Source)
at java.ibjectInputStream.readObject(Unknown Source)
at java.ibjectInputStream.inputObject(Unknown Source)
at java.ibjectInputStream.readObject(Unknown Source)
at java.ibjectInputStream.readObject(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at client.ComputePi.main(ComputePi.java:15)
http://java.sun.com/docs/books/tutorial/rmi/index.html
The server run fine with commandline
cd deployment\classes
java -classpath ".\deployment;%CLASSPATH%;"
-Djava.rmi.server.codebase=file:/c:\My_test\rmi2\deployment\classes/
-Djava.rmi.server.hostname=12.236.86.90
-Djava.security.policy=..\java.policy engine.ComputeEngine
and java.policy file as
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.io.FilePermission
"c:\\My_test\\rmi2\\deployment\\classes\\-", "read";
};
I got the exception below when trying the client with commandline
cd client_dir
java -classpath ".;compute.jar;%CLASSPATH%"
-Djava.rmi.server.codebase=file:/c:\my_test\rmi2\client_dir/
-Djava.security.policy=client.policy client.ComputePi 12.236.86.90 20
with client.policy as
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.io.FilePermission
"C:\\My_test\\rmi2\\client_dir\\-", "read";
};
I noticed that it complained the permission
"(java.io.FilePermission \c:\My_test\rmi2\deployment\classes\- read)"
which is the codebase used by the server. As you can see that
this permission is already in the java.policy used by server.
Any point about what is wrong?
thanks
============== exception when run client, ComputePi ===============
C:\My_test\rmi2\client_dir>java -classpath
".;compute.jar;.;C:\j2sdk\jre\lib
jar;C:\my_db\oracle\ora92\jdbc\lib\classes111.zip;C:\my_db\oracle\ora92\jdbc
\nls_charset11;C:\my_db\oracle\ora92\jdbc\lib\ojdbc14.jar;C:\j2sdk\lib\tools
;C:\My_try\JClass50K\lib\jcjarmasterK.jar;C:\My_try\JClass50K;C:\My_enterpri
oap-2_2/soap.jar;C:\My_enterprise\javamail-1.2\mail.jar;C:\My_enterprise\jaf
..1\activation.jar;C:\My_enterprise\soap-2_2;C:\My_enterprise\bsf-2_2\lib\bsf
;C:\My_enterprise\rhino1_5R2\js.jar"
-Djava.rmi.server.codebase=file:/c:\my_
\rmi2\client_dir/ -Djava.security.policy=client.policy
client.ComputePi 12.
86.90 20
ComputePi exception: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: access denied to class
loader
java.rmi.UnmarshalException: error unmarshalling return; nested
exception is
java.lang.ClassNotFoundException: access denied to class
loader
java.lang.ClassNotFoundException:
java.security.AccessControlException: acce
enied (java.io.FilePermission \c:\My_test\rmi2\deployment\classes\-
read)
at java.security.AccessControlContext.checkPermission(Unknown
Source
at java.security.AccessController.checkPermission(Unknown
Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.rmi.server.LoaderHandler$Loader.checkPermissions(Unknown
Sour
at sun.rmi.server.LoaderHandler$Loader.access$000(Unknown
Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveClass(Unknown
Source)
at java.ibjectInputStream.inputClassDescriptor(Unknown
Source)
at java.ibjectInputStream.readObject(Unknown Source)
at java.ibjectInputStream.readObject(Unknown Source)
at java.ibjectInputStream.inputObject(Unknown Source)
at java.ibjectInputStream.readObject(Unknown Source)
at java.ibjectInputStream.readObject(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at client.ComputePi.main(ComputePi.java:15)