• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with policy file, Security Manager

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can someone please help me
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you need to create the jar files and include the stubs with the client.jar.
Mark
 
Sri Addanki
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sri Addanki
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark , Calvin.
I think i better include a simple policy file.
Thanks again,
sri
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic