Java newbie: RMI woes on Linux

A

Andy

I am a java newbie and was trying my hand at RMI. I have an interface,
a server implementing that interface and a utility class with "public
static void main" to register the server class. I also have a client,
which calls the server using Naming.lookup(...) and calls methods on
it.
Of course, before binding the server I start the rmiregistry on my
local machine, without specifying the port and by specifying the
following option:

-J-Djava.security.policy=E:\mydir\...\rmiserver.policy

Later, when I try to register the server, the registration fails with
an access denied error on localhost:1099.

The policy file I am using is simple:

grant{
permission java.security.AllPermissions;
};

Any pointers would be greatly appreciated.

IMP: I am facing this problem on my Linux box. Whereas on my Windows,
a similar program runs without cribs. (No advocacy meant for Windows.)

Cheers,
Andy
 
N

Nigel Wade

Andy said:
I am a java newbie and was trying my hand at RMI. I have an interface,
a server implementing that interface and a utility class with "public
static void main" to register the server class. I also have a client,
which calls the server using Naming.lookup(...) and calls methods on
it.
Of course, before binding the server I start the rmiregistry on my
local machine, without specifying the port and by specifying the
following option:

-J-Djava.security.policy=E:\mydir\...\rmiserver.policy

Later, when I try to register the server, the registration fails with
an access denied error on localhost:1099.

The policy file I am using is simple:

grant{
permission java.security.AllPermissions;
};

Any pointers would be greatly appreciated.

IMP: I am facing this problem on my Linux box. Whereas on my Windows,
a similar program runs without cribs. (No advocacy meant for Windows.)

Cheers,
Andy

E:\mydir\...\rmiserver.policy
is a very strange Linux pathname.

Try without any security policy. I find this works ok on Linux for
testing/development purposes.

Do you have a firewall on the Linux box? Is it enabled, and does it allow
connections to port 127.0.0.1:1099? Is the rmiregistry actually listening
on 1099?
 
A

Andy

Nigel Wade said:
E:\mydir\...\rmiserver.policy
is a very strange Linux pathname.

LOL ... admittedly so.
Try without any security policy. I find this works ok on Linux for
testing/development purposes.

Do you have a firewall on the Linux box? Is it enabled, and does it allow
connections to port 127.0.0.1:1099? Is the rmiregistry actually listening
on 1099?

I don't have a firewall. But I am wondering if rmiregistry is actually
listening. How would you start the rmiregistry on Linux. From DOS I
did this:

start rmiregistry -J-Djava.security.policy=E:\mydir\...\rmiserver.policy


From Linux, I did this:
rmiregistry -J-Djava.security.policy=/root/.../rmiserver.policy &

I have j2sdk1.4.2 and gcj both installed. Could that cause any
problems. I have rmiregistry and all these binaries in two different
places (due to the different installations). I guess the ones being
called are from j2sdk1.4.2.

Cheers,
Andy
 
G

Gordon Beaton

I don't have a firewall. But I am wondering if rmiregistry is actually
listening.

That's easy enough to check.

Use "netstat -l" to see all listening sockets. If you have sufficient
priviliges, "netstat -lp" or "lsof -i" will also show you which
process owns each socket.

/gordon
 
N

Nigel Wade

Andy said:
Nigel Wade <[email protected]> wrote in message

LOL ... admittedly so.


I don't have a firewall. But I am wondering if rmiregistry is actually
listening. How would you start the rmiregistry on Linux. From DOS I
did this:

start rmiregistry -J-Djava.security.policy=E:\mydir\...\rmiserver.policy


From Linux, I did this:
rmiregistry -J-Djava.security.policy=/root/.../rmiserver.policy &

I have j2sdk1.4.2 and gcj both installed. Could that cause any
problems. I have rmiregistry and all these binaries in two different
places (due to the different installations). I guess the ones being
called are from j2sdk1.4.2.

Yes, they can cause problems. In fact your mentioning this reminds me I had
a very similar problem on this system with gcj, java, RMI and rmiregistry.
The gcj package has an rmiregistry binary which appears in the path so is
most likely getting started by the simple rmiregistry command. Make sure
you run the Sun JDK rmiregistry with an explicit path, or, better still,
completly remove gcj.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top