aspose file tools*
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
Author

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 -Djava.security.policy=client.policy 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
Bartender

Joined: Sep 13, 2007
Posts: 2627
    
    9

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


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Daniel Salomons
Greenhorn

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?
TIA
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: http://aspose.com/file-tools
 
subject: AccessControlException hocuspocus