RMI question

I tested the RMI examples in book Java Network rogramming (Manning, ISBN 0-13841-206-5).  I followed the steps in the book to build rmi server and client.  however, I only could run the server in jdk1.1, if I used jdk1.2, I got an exception:

exception in thread "main" java.security.AccessControlException: access enied (java.net.SocketPermission 127.0.0.1: 1099 connect, resolve)
.........

what does it mean?

Thanks
embertAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

embertAuthor Commented:
Edited text of question.
0
Ravindra76Commented:
Hi embert,

1. Find java.policy in your system.

  Replace the text in it with the following code.

grant {
      // Allow everything for now
      permission java.security.AllPermission;
};

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ravindra76Commented:
Hi embert,

 The new extended security model was defined in Java1.2 which will disallow socket permisiions to connect and resolve . In java.policy, initially all are set to defaults which will cause so many security exceptions if you are doing some sensible operations like creating a socket and listening on some port like operations.

So we have to change the default permisions to work our code with cost of reducing some level of security.

You will get all these details in this URL.

http://www.eurocom.od.ua/~sasha/books/java/JavaUnleashed_1.2/ch03/ch03.htm

Enjoy a lot.

Best of luck
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

embertAuthor Commented:
there are several copies of java.policy, in which I should make the change?

thanks,
0
Ravindra76Commented:
Hi embert,

 Put one file backup.
 Change all the java.policy files.
 It will be present in two locations only.

 One in drivename\jdkhome\JRE\lib\security
 Eg: c:\jdk121\hre\lib\security

drivename\program files\javasoft\jre\1.2\lib\security

Eg:c:\program files\javasoft\jre\1.2\lib\security.

First change these two files.

In my system only these two copies are persent.

IF it did n't work, replace all.

But put one back up copy

Best of luck
0
embertAuthor Commented:
I just replaced the java.policy file in c:\jdk121\hre\lib\security, and it worked fine.

Thanks!
0
vikas0857Commented:
create a policy file called  filename.policy where filename is any permitted name .

copy the following code and pasted it there

grant
{
permission java.net.SocketPermission *:1099","connect,accept";
permission java.security.AllPermission;

};

then after compiling your program typr the following in your command line .

java -Djava.security.policy=filename.policy YourAppl

where YourAppl is the class after compilation.

0
kodiakbearCommented:
Fixed the -1 problem on this question.
Escrow points corrected.

kb
Community Support Moderator
Experts Exchange
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.