Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.SocketException: Permission denied: listen failed

807605Jul 4 2007 — edited Jul 5 2007
Hello,

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 2 2007
Added on Jul 4 2007
8 comments
14,825 views