This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Minimal RMI server fails at in UnicastRemoteObject constructor
- From: Andrew Haley <aph at redhat dot com>
- To: "Tom O'Reilly" <oreilly at mbari dot org>
- Cc: <java at gcc dot gnu dot org>
- Date: Sat, 23 Apr 2005 11:19:21 +0100
- Subject: Re: Minimal RMI server fails at in UnicastRemoteObject constructor
- References: <019d01c54081$669f4540$68085986@newloihi>
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.