aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Problem with policy file, Security Manager 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 "Problem with policy file, Security Manager" Watch "Problem with policy file, Security Manager" New topic
Author

Problem with policy file, Security Manager

Sri Addanki
Ranch Hand

Joined: Apr 27, 2001
Posts: 195
Hi,
in my application, To run the server:
i have to type in this info:
codebase,
servername,
databasefilename
But to run the remote client i just say:
java client
I know when i use codebase, i HAVE to include the policy file and create newRMISecurityManager.
But here are some cases i found:
1. I have a policy file with all permission grants.
2. When i include policy file like this, the application works just fine:
System.setProperty("java.security.policy", "scjd.policy");
3. when i include newRMISecurityManager like this , the application runs fine:
System.setSecurityManager(new RMISecurityManager());
4. But when i include both the application DOESN'T run. It gives access control exceptions.
why?
5.When i DON'T include either of these, my application runs fine, why?
can someone please explain me?
what should i do now?
thanks,
sri
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Sri,
I deleted your duplicate post in the other thread with this same question.
You will get better response from this thread anyway.
Please refrain from duplicate posting in the future.
Thanks
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

You don't really need to have codebase, RMISecurityManager or Policy files in your assignment. These are basically used for dynamic downloading, which isn't needed here.
Good Luck
Mark
Sri Addanki
Ranch Hand

Joined: Apr 27, 2001
Posts: 195
hi Mark,
Thanks for the post.
And sorry abt the duplicate post.
Yes, i understand that i don't need codebase etc.,
for the assignment.
I tried taking out codebase and running the same, but it gives STUB NOT FOUND exceptions. I think, i need to put that stub in the classpath? I'll try figuring out that.
But can u still help me with the problem?(just curious :-)
My problem in short again is,
if i use codebase i need to use BOTH policy file and RMISecurityManager.( right?)
But i see i can still run the application WITHOUT these two.
Also if i use EITHER of these i can still run my program fine.
But if i use BOTH of these then i get Access control exeptions. why?
Can u help me in fixing this?
thanks,
sri
Sri Addanki
Ranch Hand

Joined: Apr 27, 2001
Posts: 195
Sorry for this post again,
but i wanted to ask, if it was ok or not,
to use codebase to run server and still run the client without setting RMISecurityManager?
I have a policy file, but i don't type it on the command line. I set this from the client program, in the main().
thanks,
sri
Sri Addanki
Ranch Hand

Joined: Apr 27, 2001
Posts: 195
can someone please help me
jyothi sunke
Ranch Hand

Joined: Sep 11, 2002
Posts: 65
As Mark said, u don't need policy file, SecurityManager & codebase for this assignment. What u can do is place the stub classs in the client.jar with proper directory hierarchy and make sure to set the classpath to that jar file.
Hope this helps..


jyothi
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Yes, you need to create the jar files and include the stubs with the client.jar.
Mark
Sri Addanki
Ranch Hand

Joined: Apr 27, 2001
Posts: 195
Hi,
Does this mean, i shouldn't have any policy file, not even the simple, all grant permissions?
And if so, how do i need to justify this in my Design.txt
thanks

Originally posted by jyothi sunke:
As Mark said, u don't need policy file, SecurityManager & codebase for this assignment. What u can do is place the stub classs in the client.jar with proper directory hierarchy and make sure to set the classpath to that jar file.
Hope this helps..
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Actually there is no requirement in the instructiosn saying you have to use them, so not using them doesn't require justification.
Even policy with All permissions.
Mark
calvin zhu
Ranch Hand

Joined: Mar 18, 2002
Posts: 54
Basicly I agree with with Mark, but I also think supply policy file in your project is still necessary.(only policy file, unless you are using dynamic downloading of stubs, then u need security manager things like that.)
Because u can't be 100% sure what is the the tester's environment. What if their default policy file block the port u want to use for RMI? Add a few lines won't kill u anyway. But can make sure things going to work everywhere.


SCEA, SCJD, SCWCD, SCBCD, SCJP<br />IBM WebSphere Portal certification
Sri Addanki
Ranch Hand

Joined: Apr 27, 2001
Posts: 195
Thanks Mark , Calvin.
I think i better include a simple policy file.
Thanks again,
sri
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with policy file, Security Manager