Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / June 2005

Tip: Looking for answers? Try searching our database.

policy file

Thread view: 
Daniel - 12 Jun 2005 16:02 GMT
I have this in my policyfile
grant{
permission java.net.SocketPermission "localhost:1099", "connect, resolve";
permission java.net.SocketPermission "localhost:1024-", "connect, resolve";
permission java.net.SocketPermission "localhost:1024-", "accept, resolve";
permission java.net.SocketPermission "localhost:5432", "connect, resolve";

};
in dos.
H:\sapa>java -D java.security.policy=H:\sapa\local.policy -cp "H:\sapa\sapa"
RMIServer
Exception in thread "main" java.lang.NoClassDefFoundError:
java/security/policy=
H:\sapa\local/policy

I always get this error message, I dont understand. The classes are all in
h:\sapa\sapa and the policy file is in h:\sapa\
Why does the compiler never have mercy on me? I compiled the RMIServer
without problems. WHen i start the server it gives me an eroor:

Exception: java.security.AccessControlException: access denied
(java.net.SocketPermission 127.0.0.1:5432 connect,resolve)

My database runs under postgres, without the whole RMI statements the
application works, Why cant i set the policy file?

Thanks in advance
Danny
Roland - 12 Jun 2005 21:01 GMT
> I have this in my policyfile
> grant{
[quoted text clipped - 24 lines]
> Thanks in advance
> Danny

Try and use -D without the separating space, i.e.
java -Djava.security.policy=H:\sapa\local.policy -cp "H:\sapa\sapa"
RMIServer
Signature

Regards,

Roland de Ruiter
` ___      ___
`/__/ w_/ /__/
/  \ /_/ /  \

Daniel - 12 Jun 2005 22:38 GMT
Hi Roland
I did that as well, with the same results, the thing is i cant even get it
to work on 1 pc. I heared you dont need the policy file for one pc. The
question remains, how can it work without the RMI style and now i get an
access denied error

Thanks
>> I have this in my policyfile
>> grant{
[quoted text clipped - 34 lines]
> java -Djava.security.policy=H:\sapa\local.policy -cp "H:\sapa\sapa"
> RMIServer
Daniel - 12 Jun 2005 22:58 GMT
For curious reasons i get another eroor now, it sais
Driver not found in DataModel, strange couse it is working without rmi, what
can be wrong here?

Danny

  private void initDriverClass()
  {
     try
     {
        Class.forName("org.postgresql.Driver");
     }
     catch (ClassNotFoundException e)
     {
        System.out.println("driver not found in DataModel");
        System.exit(1);
     }
  }

> Hi Roland
> I did that as well, with the same results, the thing is i cant even get it
[quoted text clipped - 41 lines]
>> java -Djava.security.policy=H:\sapa\local.policy -cp "H:\sapa\sapa"
>> RMIServer
Roland - 12 Jun 2005 23:24 GMT
> Hi Roland
> I did that as well, with the same results, the thing is i cant even get it
[quoted text clipped - 42 lines]
>>java -Djava.security.policy=H:\sapa\local.policy -cp "H:\sapa\sapa"
>>RMIServer

Maybe you need to specify also that you want the program to run with a
security manager, by adding the -Djava.security.manager option:
java -Djava.security.manager -Djava.security.policy=H:\sapa\local.policy
ETC.

According to
<http://java.sun.com/j2se/1.4.2/docs/guide/security/spec/security-spec.doc6.html#28400>
you could also try with double equals sign:
java -Djava.security.policy==H:\sapa\local.policy ETC.

Another thing I doubt that could make a difference is to use the IP
address instead of 'localhost' in the permissions. I don't think it
matters but you could give it a try:
permission java.net.SocketPermission "127.0.0:5432", "connect,resolve";
ETC.

Specifying a codebase in the grant could make a difference, though:
grant codeBase "file:///H:/sapa/sapa/" {
   permission java.net.SocketPermission  ETC.
}

It's years ago I played with RMI, so I can't remember if you can run a
RMI server without the need of a security manager or policy file.

If you haven't already had a peek over there, then the Java RMI tutorial
might give some clues:
<http://java.sun.com/docs/books/tutorial/rmi/index.html>
Signature

Regards,

Roland de Ruiter
` ___      ___
`/__/ w_/ /__/
/  \ /_/ /  \



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.