Results 1 to 4 of 4
  1. #1
    vitaliy is offline Member
    Join Date
    Jul 2007
    Posts
    2
    Rep Power
    0

    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:

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

    Java 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 12:57 PM. Reason: Codes are put inside [code] tags.

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    Hi Vitaliy,

    The port should be used by another application. Windows XP has a built-in firewall. It might be the reason.

  3. #3
    vitaliy is offline Member
    Join Date
    Jul 2007
    Posts
    2
    Rep Power
    0

    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.

  4. #4
    wiier14 is offline Newbies
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default

    hello vitality and javabean

    i have a problem like that too but mine is java.net.SocketException: Permission denied : create

    i tried to make a server on a game called minecraft and when i open the minecraft_server.exe it says this


    [INFO] Starting minecraft server version Beta 1.5_02
    [INFO] Loading properties
    [INFO] Starting Minecraft server on *:25565
    [WARNING] **** FAILED TO BIND TO PORT!
    [WARNING] The exception was: java.net.SocketException: Permission denied: create
    [WARNING] Perhaps a server is already running on that port?

    i have tried closing avira antivirous,comodo firewall,reinstalling java.
    please help me (im using windows vista)
    Any help is highly appreciated

Similar Threads

  1. Java failed to reach to a PC in local LAN
    By JavaEmpires in forum Networking
    Replies: 1
    Last Post: 01-24-2008, 06:30 PM
  2. Replies: 1
    Last Post: 08-13-2007, 03:46 AM
  3. Loading of JSP file failed
    By Heather in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 08-06-2007, 01:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •