We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › In Firefox only: loadImage->AccessControlExcept
Page Index Toggle Pages: 1
In Firefox only: loadImage->AccessControlExcept (Read 1035 times)
In Firefox only: loadImage->AccessControlExcept
Aug 29th, 2008, 11:59pm
 
I created an applet using Processing at http://stage.appletree.com.  But for some reason it doesn't work in Firefox.  IE7 works perfect.  When loading images using loadImage(url), I get the following exception:
java.security.AccessControlException: access denied (java.net.SocketPermission 75.101.139.28:80 connect,resolve)

I tried also going to the IP at http://75.101.139.28 with no luck.  Any idea why my Processing applet isn't working?  Am I using loadImage() wrong?  I understand that applets can only access resources on the same server the applet came from, but that's exactly what I'm doing in this case.
Re: In Firefox only: loadImage->AccessControlEx
Reply #1 - Aug 30th, 2008, 12:51am
 
works fine, using FF 3.0.1
Re: In Firefox only: loadImage->AccessControlEx
Reply #2 - Aug 30th, 2008, 10:45am
 
I've done a ton of testing on this issue.  It appears to be a MASSIVE bug in either firefox or the java plugin for firefox.  My guess is it's firefox, but many people report this bug as a java plugin issue.  This affects all Processing applets that use loadImage or XMLElement with a URL.  It looked like the problem was firefox (or the java plugin) converts the domain name from loadImage or XMLElement to an IP address as the exception would indicate.  And then it doesn't realize that the domain name and IP point to the same place so it throws an exception as it should otherwise.  I can't make my website have an IP address as its URL, so I was really discouraged thinking I couldn't use Processing for my web application Sad.

But there's an easy workaround I found for loading images.  Simply use the IP address of the server where the applet came from (and images will come from).  The fact that this works leads me to believe the issue is the other way around, firefox converts your website domain to an IP and gets confused when loadImage tries a domain name.  But XMLElement doesn't work either way Sad.  When trying to instantiate an XMLELement with new XMLElement(this, "http://<my_ip>/tree.xml"), I now get the following exception:
Couldn't create a reader for http://<my_ip>/tree.xml
Exception in thread "Animation Thread" java.lang.NullPointerException
at java.io.Reader.<init>(Unknown Source)

Anybody have any ideas on how I can get XMLElement to work in an applet?

Processing has 2 additional issues when exporting applets I realized:
1) the html for visitors without java leads you to an old link with only jre 1.4 (and lower versions).  But installing it breaks your Processing app as Processing requires jre 1.5 I guess.
2) the html ends up loading 2 copies of your applet in firefox.  I guess firefox understands both <object>'s.

So here's what I found out in regards to Processing applets:
1) they work on all browsers except firefox
2) they work on firefox if you use an IP for the URL of the website
3) they work on firefox on mac and windows vista
4) they DON'T work if you get resources through a URL with domain name on Win2003 server and WinXP
5) the OS issue above may be a coincidence in my testing and really it's an issue of the firefox java plugin version you use
6) you can work around loadImages by using an IP in the URL
7) I wasn't able to get XMLElement to work in firefox on WinXP

To the poster above, what OS and Java version are you using?
Re: In Firefox only: loadImage->AccessControlEx
Reply #3 - Sep 1st, 2008, 9:23am
 
In case anybody's wondering, I have some more information on this issue.  The bug in firefox, or its Java plugin, is specifically that you can't have multiple jars and load images or resources (like XML) when the webpage is loaded with a domain name instead of an IP address.  The workaround is to simply not have multiple jars and then firefox seems to behave properly.  But actually the latest version (0148) has a bug that only exports applets as multiple jars even if you have that option checkmarked off in preferences.  So I had to revert back to an old version of Processing to get my applet to work properly in firefox.

On the firefoxes that have a problem with multiple jarred applets, they also load your applet twice.  At first I thought firefox was simply being non-html compliant and loading both the outer and inner applets.  But upon further testing, it just loads the outer applet twice.  Maybe you can detect the other loading in your setup() method and stop it with a synchronized block?  My applet is growing in size so this bug makes it a little sluggish at first unfortunately.
Page Index Toggle Pages: 1