Re: RMI-USERS Digest - 27 May 2007 to 30 May 2007 (#2007-17)

Lenny Wintfeld <[email protected]> Thu, 31 May 2007 11:57:26 -0400
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Esmond Pitt wrote:
> Lenny
>
> I can talk you through this. Basically the exception text and the security
> policy file must agree. If this seems to be the case the only real
> possibility is that you aren't setting the policy file location correctly.
> Try running your application with -Djava.security.debug=access,failure to
> see exactly what it prints when the access control exception occurs.
> Specifically it will print the protection domain in effect, which will tell
> you whether your policy file has taken effect. If AllPermission didn't work
> either this points to the same problem.
>
> EJP
>
>
>
>
Esmond,

Thanks very much. Your advice to use

-Djava.security.debug=access,failure

has helped me find and fix the problem!

It turns out that there were 2 problems that using  java.security.debug
helped me find.

The first one (and the one relevant to the security issue) was that I
had my client.policy file in the same directory as the .class files on
the client linux computer. And in the way I specified it in my code

  System.setProperty("java.security.policy", "client.policy");

it had to be in the parent directory of the client package.

The second problem was that the interface ".class"  file for the object
being called  at the server  was in the same directory  as the client
code  on the client machine; but that interface has its own package
name and had to  (or course) have its  own directory entry  on the
client machine.

There may have been even a third cause of the problem which was the
actual content of the "client.policy file". I've tried so many different
ones that some them may have also been yet another cause of the problem.
Just out of curiosity I will give some of them a try now and see what
happens. The one which worked is

grant
{
 permission java.security.AllPermission;
};

grant
{
 permission java.net.SocketPermission "192.168.45.105:1024-65535","connect";
};


Thanks again. That extra diagnostic information very quickly pointed out
what was (and more importantly what was NOT) causing all the grief  I've
been going through for the last 1  1/2 days!

Regards,

Lenny Wintfeld
CecilRep LLC
NYC

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html