Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

not able to run the sample program of rmi in oracle rmi trails ?

 
Ranch Hand
Posts: 924
1
Netbeans IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i try to run the example given in the rmi trails of oracle java tutorial given at http://docs.oracle.com/javase/tutorial/rmi/running.html. i get the following exception while running the server program

C:\Users\gurpreet>java -cp D:\home\ann\src;D:\home\ann\public_html\classes\compu
te.jar -Djava.rmi.server.codebase=file:/D:/home/ann/public_html/classes/compute.
jar -Djava.rmi.server.hostname=mycomputer.example.com -Djava.security.policy="F:
\server.policy" engine.ComputeEngine
ComputeEngine exception:
java.security.AccessControlException: access denied ("java.net.SocketPermission"
"127.0.0.1:1099" "connect,resolve")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at engine.ComputeEngine.main(ComputeEngine.java:34)

uptil now i have compiled all the source files as mentioned in the tutorial. then i started the registry.when i tried to start the server program which in the tutorial is ComputeEngine it gives above exception. please help

 
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to have a policy file with RMI, such as:

and on your script add: -Djava.security.policy=%WHERE YOU PUT IT%\Security\policy.all
 
gurpeet singh
Ranch Hand
Posts: 924
1
Netbeans IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Edward Harned wrote:You need to have a policy file with RMI, such as:

and on your script add: -Djava.security.policy=%WHERE YOU PUT IT%\Security\policy.all



thanks for the reply Edward but i'm getting exact same error. i even turned my firewall off still same exception stack trace
 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a permission problem. The "all" permission policy works for ALL permissions. So java isn't finding your policy file. When java doesn't find a policy file it never says so, it just craps out. Look further into finding the file.
 
gurpeet singh
Ranch Hand
Posts: 924
1
Netbeans IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Edward

Following are the policy files i'm using and the command used to invoke the server

 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the file I gave you with: permission java.security.AllPermission "", "";

The RMI Registry is a Java program and also needs a permission file.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
uptil now i have compiled all the source files as mentioned in the tutorial. then i started the registry.when i tried to start the server program which in the tutorial is ComputeEngine it gives above exception. please help
 
gurpeet singh
Ranch Hand
Posts: 924
1
Netbeans IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi brwon jett. i thought it is me who is getting the same exception. i guess there is some error in the tutorial or some piece of code needs to be alighend/changed. until now i tried many things. what i gathered so far is that the problem is in the policy files. i tried different thigns but without in vain. still waiting for someone who actualy ran that code or who can help us solve this problem.
 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been doing RMI since release 1.1. I gave you a policy file that works. Use it. Other people have been using the tutorial for over a decade. Perhaps the problem is not with the tutorial.
 
gurpeet singh
Ranch Hand
Posts: 924
1
Netbeans IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Edward Harned wrote:I've been doing RMI since release 1.1. I gave you a policy file that works. Use it. Other people have been using the tutorial for over a decade. Perhaps the problem is not with the tutorial.



no offence Edward but if everything in the tutorial is correct you wouldn't have given me the policy files. anyways as I told earlier I used the policy files which you gave me and getting the same exception. also because of some reason i'm not able to come back to the problem and solve it. I will try to research and post here after 19th feb(I have OCEWCD 6 exam that day)

meanwhile I think brown jett can post his code here and you can help him out
 
That feels good. Thanks. Here's a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic