It's not a secret anymore!
The moose likes Distributed Java and the fly likes RMI Applet ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Applet !" Watch "RMI Applet !" New topic

RMI Applet !

Betty Cramer

Joined: Nov 19, 2003
Posts: 4
First timer here...bear with me.
I am running a RMI server and an applet with one interface for the RMI Server. This part works fine. The .class files and the html is deployed thru TOMCAT 4.1
The problem is however when the server code is changed to handle callbacks with the applet. Have already changed the security policy file. Now the applet too has its own interface.
Compiled the .java files and also rmic applet and rmic server. Started the registry after that. And the server too with the codebase too mentioned with -Djava.rmi.server.codebase. (As in the HelloWorld example on the sun website) So far so good.
However as soon as I load the appletviewer as http://localhost:8080/page.html (As I am running Tomcat) the error I get is:
IO Exception while reading: Connection refused: connect
Everything is right now local and am lost...Any help will be really appreciated. Thanks a bunch.
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
OK, I'm not understanding whether you created a second interface or whether you just expanded the one you had. Do you mean that you are trying to run the applet as a server so that your real server can call it back? I'm not sure if you can have an applet act as a server.
Any one else know? (Michael?)
Is there any way you could set up a polling system where your applet just touches base with the server and if there is anything that needs to be passed to the applet you get a returned value that then touches off a different request from the applet for the specific data to be retrieved?
This is a bit out of my league since I haven't done applets with RMI, but I'll help as I can.
Betty Cramer

Joined: Nov 19, 2003
Posts: 4
I am sorry for not being very clear on this. Hope this helps.
This link has the "QuoteServer" example which is on the same lines as my project.
In the above example I compile all four files and then generate rmic for applet and server. Then I place all the class files and the related html for the applet in TOMCAT.
Policy file:
grant {
// Allow everything for now
permission "*:1024-65535", "connect,accept";
permission "*:80", "connect";
Then I start my TOMCAT and then the server with codebase=http:\\localhost:8080\(my folder)\ and the security file as mentioned above. So far so good.
The problem occurs when I start my applet as
appletviewer"above file here" http:\\localhost:8080\page.html
Also when I loaded the applet in IE I got the AccessControlException:access denied. Can you also direct me as to how to direct the above security policy file in IE?
Thanks in advance for your patience. I hope I am clearer this time. Please let me know if more details are required.
Appreciate your help.
I agree. Here's the link:
subject: RMI Applet !
It's not a secret anymore!