Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

AccessControlException hocuspocus  RSS feed

 
Juhan Voolaid
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3639
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you use RMI and have the security manager (which is forbidden) you automatically failed.
 
Daniel Salomons
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep. Without specifying any security policy and not doing that:
System.setSecurityManager(new RMISecurityManager());

... my application works without problems.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!