Minimal RMI server fails at in UnicastRemoteObject constructor

Andrew Haley aph@redhat.com
Sat Apr 23 10:27:00 GMT 2005


Tom O'Reilly writes:
 > Hello,
 > 
 > I'm new to gcj, and trying to compile an RMI server to native code on my
 > Linux (Fedora) workstation. Any help would be greatly appreciated! I am
 > running gcj version 3.4.2.
 > 
 > My server ("BenchServer") is quite minimal; it extends
 > UnicastRemoteObject, and implements an interface ("Benchmark") that
 > contains just one method. The server's constructor first invokes
 > "super()", which generates an ExceptionInInitializerError, with message
 > "Operation not allowed".
 > 
 > Here are my build steps:
 > 
 > Compile the BenchServer class with javac, so that we can use gjc to
 > generate stub/skeleton
 > javac BenchServer.java
 > 
 > Generate stub:
 > rmic -v1.2 -d . BenchServer
 > 
 > Convert stub to native code:
 > gcj -c BenchServer_Stub.class
 > 
 > Compile .java source files to native code:
 > gcj -c Benchmark.java BenchServer.java
 > 
 > Next, link the objects, specify "main" and "policy" file:
 > gcj Benchmark.o BenchServer.o 
 > BenchServer_Stub.o --main=BenchServer -Djava.security.policy=policy
 > 
 > The policy file looks like this:
 > grant {
 > // Allow everyone access to everything
 > permission java.security.AllPermission;
 > };
 > 
 > Now I run the a.out executable, which takes one argument (the host
 > name):
 > 
 > a.out etna
 > Setting security manager
 > Constructing server...
 > Got Exception: Operation not allowed
This is because of a security check that is bogus. I removed it in 4.0.
I also fixed some RMI bugs. I wouldn't attempt to use RMI in 3.4.x.
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /