dcsimg
Applets / Data Access / RMI
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rich_Croft
Posted On:   Monday, December 1, 2008 09:29 AM

Hi, I'm new to Applet programming but I'm a fairly experienced Java and J2EE developer. I basically want an applet that can run in a browser that can access DAO style services on the web server that provides the applet. My plan is currently to use RMI although I'm open to suggestions/best practises and I am aware that I might be trying to achieve something isn't possible. I have 3 projects tomcat webapp - contains DAO and RMI Server implementations. on startup registers RMI server using java.rmi.registry.Registry, includes shared jar in classpath applet - contains JApplet extension, tries to pull Server out of RMI Registry and execute methods shared - cont   More>>

Hi,



I'm new to Applet programming but I'm a fairly experienced Java and J2EE developer.



I basically want an applet that can run in a browser that can access DAO style services on the web server that provides the applet.



My plan is currently to use RMI although I'm open to suggestions/best practises and I am aware that I might be trying to achieve something isn't possible.



I have 3 projects


tomcat webapp - contains DAO and RMI Server implementations. on startup registers RMI server using java.rmi.registry.Registry, includes shared jar in classpath


applet - contains JApplet extension, tries to pull Server out of RMI Registry and execute methods


shared - contains RMI Server interface and Serializable DTOs/POJOs (whatever were calling them these days) that I want to transfer from applet to webserver and vise versa.




My current development environment is RAD6 using tomcat5.0 and JDK1.4. Although I will be shifting onto NetBeans or Eclipse and Java5 or Java6 in the near future. Any recommendations for this kind of project?



I've managed to successfully run the applet in the applet viewer but can't run it from within a web page. It seems to pull the Object successfully out of the Registry (using java.rmi.registry.Registry.lookup) but I get a java.security.AccessControlException (see below) when trying to call a method on it. I have signed my applet jars.



java.security.AccessControlException: access denied (java.net.SocketPermission 172.16.145.19:1980 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 sun.rmi.transport.tcp.TCPChannel.checkConnectPermission(Unknown Source)

at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)

at sun.rmi.server.UnicastRef.invoke(Unknown Source)

at com.rmitest.web.rmi.ServerImpl_Stub.testRMI(Unknown Source)

at com.rmitest.applet.main.RMIApplet.init(RMIApplet.java:35)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)



I'm aware of the restrictions involved of applet programming but from what I read I think that I should be able to do this if I'm only connecting to the server that has given the applet.



Am I trying to achieve something that will never work or do I have a wire crossed somewhere?



Thanks in advance for any help/advice



Cheers.

   <<Less
About | Sitemap | Contact