For Programmers: Free Programming Magazines  


Home > Archive > Java Security > April 2006 > java.security.AccessControlException









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author java.security.AccessControlException
sundar22in@gmail.com

2006-04-28, 4:06 am

Hi,
Iam creating an audio player applet. Iam getting the audio inputstream
by the folloing line of code

stream = AudioSystem.getAudioInputStream(new
URL("http://hostname/path/audiofile.wav"));


But when we execute this i get the following
error.......................

java.security.AccessControlException: access denied
(java.net.SocketPermission [hostname] resolve)


How to fix this problem in java applet. Is there any other way to get
an audiofile in the web otherthan URL method???? Kindly reply.

Yours,
Sundar

Thomas Hawtin

2006-04-28, 7:06 pm

sundar22in@gmail.com wrote:
>
> stream = AudioSystem.getAudioInputStream(new
> URL("http://hostname/path/audiofile.wav"));
>
>
> But when we execute this i get the following
> error.......................
>
> java.security.AccessControlException: access denied
> (java.net.SocketPermission [hostname] resolve)


It looks as if your problem is with the URL. You will probably have the
same problem if you try:

new URL("http://hostname/path/audiofile.wav").openStream();

In order to work, the URL will need to point to the same machine (IP
address) that the applet is downloaded from.

If the files reside on a separate server, you'll need to set up some
form of proxy on the applet's web server. (Or sign the applet.)

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
Mike Amling

2006-04-28, 7:06 pm

Thomas Hawtin wrote:
> sundar22in@gmail.com wrote:
>
>
>
> It looks as if your problem is with the URL. You will probably have the
> same problem if you try:
>
> new URL("http://hostname/path/audiofile.wav").openStream();
>
> In order to work, the URL will need to point to the same machine (IP
> address) that the applet is downloaded from.


That's true if the applet was downloaded from a server specified by
IP address, but often the server is specified by a domain name, and in
that case, the last time I checked, the domain name has to match,
regardless of how many other domains are hosted at the same IP address.

> If the files reside on a separate server, you'll need to set up some
> form of proxy on the applet's web server. (Or sign the applet.)


Agreed.

--Mike Amling
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com