Access denied

N

NB

I'm getting this error:

java.security.AccessControlException: access denied
(java.net.SocketPermission 127.0.0.1:80 connect,resolve)

with the following code:

URL url = new URL("http://127.0.0.1/application/script.asp");
InputStream inputStream = url.openConnection().getInputStream();

Why is that? I didn't get the error on my local machine where I
developed and tested the application but when deployed on the web server
I get error.
 
C

Chris Smith

NB said:
I'm getting this error:

java.security.AccessControlException: access denied
(java.net.SocketPermission 127.0.0.1:80 connect,resolve)

with the following code:

URL url = new URL("http://127.0.0.1/application/script.asp");
InputStream inputStream = url.openConnection().getInputStream();

Why is that? I didn't get the error on my local machine where I
developed and tested the application but when deployed on the web server
I get error.

You are running this code in a context with a security manager, and the
security manager is not configured to let you make that network
connection.

This is unusual for an application. Applications don't typically run
under security managers. Are you sure this isn't an applet instead?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
N

Nigel Wade

I'm getting this error:

java.security.AccessControlException: access denied
(java.net.SocketPermission 127.0.0.1:80 connect,resolve)

with the following code:

URL url = new URL("http://127.0.0.1/application/script.asp");
InputStream inputStream = url.openConnection().getInputStream();

Why is that? I didn't get the error on my local machine where I
developed and tested the application but when deployed on the web server
I get error.

Are you sure that's what you really want to be doing?

That's going to download the (I presume) applet from the web server to
the client, and then attempt to open a connection to a web server on the
*client* to run the asp script. Maybe you want to change 127.0.0.1 to the
address of the web server, or even better use getCodeBase().

Besides being strange, it's also not allowed unless the applet is signed.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top