Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes AccessControlException hocuspocus Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "AccessControlException hocuspocus" Watch "AccessControlException hocuspocus" New topic

AccessControlException hocuspocus

Juhan Voolaid
Ranch Hand

Joined: Nov 18, 2003
Posts: 179
When I try to make a RMI connection with my client application, I get AccessControlException.
Solution for that would be configuring the security policy like that:
java -jar runme.jar

The client.policy file:

But the instructions clearly say that: "Your programs must not require use of command line property specifications".

So what are my options?

I have read that security policy is only required when the stubs are not provided, but I have included them - how do I test that anyway?
Juhan Voolaid
Ranch Hand

Joined: Nov 18, 2003
Posts: 179
Ok, found it.

The problem was, that I set new security manager in my code:
System.setSecurityManager(new RMISecurityManager());

Just had to delete it and it worked fine. I accidentally copied that code from RMI tutorial.
K. Tsang

Joined: Sep 13, 2007
Posts: 3132

if you use RMI and have the security manager (which is forbidden) you automatically failed.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
Daniel Salomons

Joined: Oct 07, 2004
Posts: 5
Hi everybody,
I hav the Bodgitt & Scarper assignment.
I must not require the installation of a security manager. Does this mean I must not include a policy file?
Gr Daniel
Juhan Voolaid
Ranch Hand

Joined: Nov 18, 2003
Posts: 179
Yep. Without specifying any security policy and not doing that:
System.setSecurityManager(new RMISecurityManager());

... my application works without problems.
I agree. Here's the link:
subject: AccessControlException hocuspocus
It's not a secret anymore!