File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AccessControlException hocuspocus

 
Juhan Voolaid
Ranch Hand
Posts: 179
  • 0
  • 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
  • 0
  • 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
Pie
Posts: 3222
12
Android Java
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic