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

Discussion in 'Java' started by carrilho.paulo@gmail.com, Oct 14, 2007.

  1. Guest

    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
    , Oct 14, 2007
    #1
    1. Advertising

  2. Lew Guest

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

    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
    Lew, Oct 14, 2007
    #2
    1. Advertising

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

    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 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
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Oct 14, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
    Replies:
    1
    Views:
    10,226
  2. oziris
    Replies:
    1
    Views:
    579
  3. Ken North
    Replies:
    0
    Views:
    586
    Ken North
    Jul 14, 2005
  4. Replies:
    1
    Views:
    10,109
  5. wwj
    Replies:
    0
    Views:
    497
Loading...

Share This Page