java.net.SocketException: Permission denied: listen failed
807605Jul 4 2007 — edited Jul 5 2007Hello,
I'm experiencing the weirdest problem ever -
it seems that I"m unable to open a java server socket on my machine.
Here is a sample code that demonstrates my problem:
-------------------------------------------------------------------------------------------------
import java.io.IOException;
import java.net.*;
public class SocketTest
{
/**
* @param args
*/
public static void main(String[] args)
{
ServerSocket myService;
try
{
myService = new ServerSocket(8080);
System.out.println("successfully opened a socket");
}
catch (IOException e)
{
e.printStackTrace();
System.out.println(e);
}
}
}
------------------------------------------------------------------------------------------------
Here is the exception that I get:
-----------------------------------------------------------------------------------------------
java.net.SocketException: Permission denied: listen failed
at java.net.PlainSocketImpl.socketListen(Native Method)
at java.net.PlainSocketImpl.listen(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at SocketTest.main(SocketTest.java:18)
java.net.SocketException: Permission denied: listen failed
------------------------------------------------------------------------------------------------
I'm trying to run this app on winxp machine, jre 1.5.0_11.
This problem also happens not ony while running this application, but while trying to start other java applications like tomcat.
If I try to connect to already used port, I get a different exception, so I know this port is free.
I've already tried to reinstall the jre, as well as rebooting my machine.
Also I have no firewall or antivirus running.
Any help is highly appreciated!
Thanks,
Vitaliy