Java Applets connecting to Databases: access denied (java.net.SocketPermission ... resolve)

  • Follow


Hi folks,I'm new about developing Java applets and I need some help.I'm developing a Web Application based on JSPs and Tomcat in Netbeans.I've also developed a Java Applet which its package has some classes.This Applet connects to a Sybase Database (JConnect) in order to querysome information. It works fine when I run the Applet Class atNetbeans.The Jar containing this Applet (and the Jar supporting the DB driver)is embedded into a JSP of my Web Application through JSP Plugin tag.When I call for this JSP (where the Applet is embedded) I get thiserror (at the Client Java Console):java.security.AccessControlException: access denied(java.net.SocketPermission ... 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.InetAddress.getAllByName0(Unknown Source)	at java.net.InetAddress.getAllByName(Unknown Source)	at java.net.InetAddress.getAllByName(Unknown Source)	at java.net.InetAddress.getByName(Unknown Source)	at java.net.InetSocketAddress.<init>(Unknown Source)                ...How can I fix it?Regards
0
Reply carrilho.paulo (7) 10/14/2007 8:00:41 PM

carrilho.paulo@gmail.com wrote:> I'm new about developing Java applets and I need some help.Please, please, please, please, please do not multi-post.> java.security.AccessControlException: access denied> (java.net.SocketPermission ... 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.InetAddress.getAllByName0(Unknown Source)> 	at java.net.InetAddress.getAllByName(Unknown Source)> 	at java.net.InetAddress.getAllByName(Unknown Source)> 	at java.net.InetAddress.getByName(Unknown Source)> 	at java.net.InetSocketAddress.<init>(Unknown Source)>                 ...> > > How can I fix it?Sounds like you need to sign your applet.-- Lew
0
Reply Lew 10/14/2007 8:40:53 PM


carrilho.paulo@gmail.com wrote:> I'm new about developing Java applets and I need some help.> > I'm developing a Web Application based on JSPs and Tomcat in Netbeans.> > I've also developed a Java Applet which its package has some classes.> This Applet connects to a Sybase Database (JConnect) in order to query> some information. It works fine when I run the Applet Class at> Netbeans.> > The Jar containing this Applet (and the Jar supporting the DB driver)> is embedded into a JSP of my Web Application through JSP Plugin tag.> > When I call for this JSP (where the Applet is embedded) I get this> error (at the Client Java Console):> > java.security.AccessControlException: access denied> (java.net.SocketPermission ... resolve)An applet can with normal privs only connect to the same host asit is downloaded from.You can work around that by signing the applet.You can do that for an intranet context.You should not do that for an internet context.Because everybody can decompile an appletand read the Sybase username and password used to connectand it is generally considered bad practice to make a databaseserver an edge server.Arne
0
Reply ISO 10/14/2007 9:04:10 PM

2 Replies
625 Views

(page loaded in 0.05 seconds)

Similiar Articles:





7/21/2012 5:03:05 PM


Reply: