Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  getting odd security exception in my applet  (Read 1616 times)
0 Members and 1 Guest are viewing this topic.
Offline Wildern

Junior Member





« Posted 2009-02-23 03:40:00 »

The error is "Error connecting to server: java.security.AccessControlException: access denied (java.net.SocketPermission [http://www.forgottendusk.cjb.net] resolve)"

The applet is attempting to connect to the main game server on the machine that is hosting the applet.  The applet should not need signing.

The odd part about this error is that, currently, it is only happening on Vista and Ubuntu, XP works just fine (I don't have access to any other platforms for testing).

Is there some reason Ubuntu and Vista won't allow the connect back to the hosting server?
Is it an issue with dynamic DNS used by the host?
Something else?
OK, looking closer at the error, I see that the hosting page is forgottendusk.cjb.net and the error is for www.forgottendusk.cjb.net... but changing the URL of the applet page to www.forgottendusk.cjb.net doesn't change the error.

This is really old code that I helped out with when I was learning java many years ago.  I am fairly certain it was built targeting 1.3 as a runtime platform.

Any help would be appreciated.
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #1 - Posted 2009-02-23 09:00:24 »

maybe oyu are changing the url in the wrong place. Or it is getting the URL from somewhere you dont notice.
Offline Wildern

Junior Member





« Reply #2 - Posted 2009-02-23 12:48:12 »

maybe oyu are changing the url in the wrong place. Or it is getting the URL from somewhere you dont notice.

Well, I am typing "http://www.forgottendusk.cjb.net" into the browser and "http://www.forgottendusk.cjb.net" is a parameter passed into the applet.  I would think that if I am getting the wrong URL, I would be getting the wrong URL on XP as well.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #3 - Posted 2009-02-23 17:57:02 »

do you mean int he browser, or in a textbox?
Offline Wildern

Junior Member





« Reply #4 - Posted 2009-02-23 19:33:38 »

do you mean int he browser, or in a textbox?

I am typing "http://www.forgottendusk.cjb.net" into the browser

Basically, the host portion of URL of the page serving up the applet exactly matches the host reported in the security exception.
I was under the impression that this exception would be triggered by the applet attempting to contact a host other than the one serving up the applet.  If the applet was attempting to contact a different host, I would also assume that XP would get the exception as well.
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #5 - Posted 2009-02-23 19:47:44 »

I cant really help you, I dont know much about networking. I jsut figured I give you my two cence.

GL
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 757
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2009-02-23 23:02:39 »

1  
new Socket("www.forgottendusk.cjb.net", 80);


How about that?



One thing that struck me:
Quote
Error connecting to server: java.security.AccessControlException:
access denied (java.net.SocketPermission [http://www.forgottendusk.cjb.net] resolve)"
should be:
Quote
Error connecting to server: java.security.AccessControlException:
access denied (java.net.SocketPermission [www.forgottendusk.cjb.net] resolve)"

As you cannot resolve "http://....etc..."  as a hostname

Maybe you're calling:
new Socket("http://www.forgottendusk.cjb.net", 80);
?




If all fails, you're probably running Firefox and making your initial connection off the EDT. (I know that sounds far fetched, but it *is* a bug.) The Java plugin has quite a few bugs in Firefox, that cause the AccessControlException. Search these forums a bit. In older versions (like 1.6.0_u07) I ran into this issue. Under certain circumstances, you get the above exception, if you just create a new thread and connect. If you make your initial connection inside Applet.{init|start}() all future connections from any thread will work just fine. It smells like a race-condition, but I cannot reproduce it since u11.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Xyle
« Reply #7 - Posted 2009-02-24 06:21:31 »

I was getting this same error for no apparent reason, then I remembered that I changed the code for the socket connection. I had to look at some other stuff I programmed to find out why it was working there and not here and I found it

this didnt work for me, I still got the socket permission error
1  
2  
servName = "http://www.mightyrealms.com";
ccSock = new Socket(servName,pNum);


this fixed the error for me
1  
2  
//this.getCodeBase().getHost() //must use this or u get socket.permission error
ccSock = new Socket(this.getCodeBase().getHost(),pNum);


Hopefully this helps!

Life is just a game, learn to play!
------------------------------------------
╬-YellzBellz Games!-╬ Cheesy
Offline Wildern

Junior Member





« Reply #8 - Posted 2009-02-24 14:39:28 »

This was it, changed the argument to the applet to not include the http:// and the problem went away.
Odd that XP should behave differently.

Many thanks.

1  
new Socket("www.forgottendusk.cjb.net", 80);


How about that?



One thing that struck me:should be:
As you cannot resolve "http://....etc..."  as a hostname

Maybe you're calling:
new Socket("http://www.forgottendusk.cjb.net", 80);
?




If all fails, you're probably running Firefox and making your initial connection off the EDT. (I know that sounds far fetched, but it *is* a bug.) The Java plugin has quite a few bugs in Firefox, that cause the AccessControlException. Search these forums a bit. In older versions (like 1.6.0_u07) I ran into this issue. Under certain circumstances, you get the above exception, if you just create a new thread and connect. If you make your initial connection inside Applet.{init|start}() all future connections from any thread will work just fine. It smells like a race-condition, but I cannot reproduce it since u11.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (15 views)
2014-08-01 22:53:16

CogWheelz (15 views)
2014-08-01 22:51:43

CopyableCougar4 (16 views)
2014-08-01 19:37:19

CogWheelz (19 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (35 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36
Resources for WIP games
by CogWheelz
2014-08-01 18:20:17

Resources for WIP games
by CogWheelz
2014-08-01 18:19:50

List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!