Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-04-2007, 01:52 PM
Member
 
Join Date: Jul 2007
Posts: 2
Rep Power: 0
vitaliy is on a distinguished road
Default java.net.SocketException: Permission denied: listen failed
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:

Code:
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:

Code:
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

Last edited by JavaBean; 07-04-2007 at 01:57 PM. Reason: Codes are put inside [code] tags.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-06-2007, 08:43 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
Rep Power: 10
JavaBean is on a distinguished road
Default
Hi Vitaliy,

The port should be used by another application. Windows XP has a built-in firewall. It might be the reason.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-09-2007, 12:20 PM
Member
 
Join Date: Jul 2007
Posts: 2
Rep Power: 0
vitaliy is on a distinguished road
Default It's not a firewall issue
The windows firewall was down.

Anyway I've managed to resolve the problem -
I've reinstalled the jre at a different location -
and it works.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java failed to reach to a PC in local LAN JavaEmpires Networking 1 01-24-2008 07:30 PM
Initial SessionFactory creation failed escit Database 1 08-13-2007 04:46 AM
Loading of JSP file failed Heather JavaServer Pages (JSP) and JSTL 2 08-06-2007 02:15 AM


All times are GMT +2. The time now is 03:08 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org