Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
carrilho.paulo@gmail.com - 14 Oct 2007 21:00 GMT
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 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)
    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
Lew - 14 Oct 2007 21:40 GMT
> 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)
[quoted text clipped - 10 lines]
>
> How can I fix it?

Sounds like you need to sign your applet.

Signature

Lew

Arne Vajhøj - 14 Oct 2007 22:04 GMT
> I'm new about developing Java applets and I need some help.
>
[quoted text clipped - 13 lines]
> java.security.AccessControlException: access denied
> (java.net.SocketPermission ... resolve)

An applet can with normal privs only connect to the same host as
it 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 applet
and read the Sybase username and password used to connect
and it is generally considered bad practice to make a database
server an edge server.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.