The problem is very simple: I've created an applet which connects to an Apache Derby's database in a remote host (http://javapoly.gotdns.com:1527). Running it from the IDE runs fine (meaning that the port is opened and listening), but when loading it from a web browser (as usual), prompts me with the following error:
java.security.AccessControlException: access denied (java.net.SocketPermission javapoly.gotdns.com 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.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at java.net.InetSocketAddress.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
at org.apache.derby.client.am.Connection.<init>(Unknown Source)
at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at TestDesarrollo.BossSistema.<init>(GuiSistema.java:63)
at TestDesarrollo.GuiSistema.init(GuiSistema.java:134)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I've started the server using:
NetworkServerControl start -h javapoly.gotdns.com -p 1527 -noSecurityManager //even though I know it's the default port and not very wise to run it without a security policy
Still, it doesn't work.
Of course that the applet is signed (I always run the Jarsigner from the build.xml and update the .jar file).
The last thing I tried was to modify the applet.policy as follows:
grant {
permission java.security.AllPermission;
permission java.net.SocketPermission "javapoly.gotdns.com", "resolve";
};
grant codeBase "http://javapoly.gotdns.com/*" {
permission java.net.SocketPermission "*", "resolve";
};
Still, the same Exception. Adding this code to java.policy in the SDK directory doesn't help either.
Guys, any ideas?? Please... I lost my sleep with this!!!