This discussion is archived
14 Replies Latest reply: May 2, 2008 5:35 PM by 843798 RSS

Failed to connect to remote VM. Connection refused

843798 Newbie
Currently Being Moderated
Hi ,
When I try to run eclipse debugger, I am getting the error:
Failed to connect to remote VM. Connection refused

I tried to debug remote java application.

any thoughts ?
  • 1. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    You should ask this question at eclipse.org.
  • 2. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    Hi,
    To solve this problem, you need to carry out these steps.

    1)In the eclipse window, click on the debug icon, select "Remote Java Application" from the list of configurations. Right click on the "Remote Java Application" and create a new configuration for your application.

    On the right hand side, there will be three tabs, namely "Connect" ,"Source" and "Common". Click on the "Connect" tab and set the connection properties, host as "localhost" and port as "8000".

    2) In the enviornment variables, add an entry jpda_address=8000;This is the default connection port used by eclipse when you try to connect to a remote VM for debug.

    3)Open catalina.bat (inside the bin folder of tomcat) and search for "set JPDA_TRANSPORT". Set the value to dt_socket.

    4)Open startup.bat(inside the bin folder of tomcat) and search for call "%EXECUTABLE%" start %CMD_LINE_ARGS%. Its at the end of the file. Replace this with call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS% (mind the spaces, better copy and paste).

    5)Save the changes and start the tomcat server using its startup.bat file. The first line appearing on the server window should be "Listening for transport dt_socket at address: 8000. This indicates that all is well..:-). Go to eclipse debug perspective, add breakpoints and start debugging...:-)

    Gud Luck..!!!!
  • 3. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    Your solution is very fine. If you dont mind, could i know how can i do Same thing for JBoss Server.

    Thanks and Regards, Ravikumar.M
  • 4. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    This in my opinion a small Eclipse glitch.
    I was running my applet fine and allof a sudden got this error after adding another applet to debug.
    I made it work by selecting Debug As.. instead of Debug
    or after that with Debug:
    Making sure to select the applet and not the Remote Java Application before clicking Debug
  • 5. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    I ma trying to compiling Opentaps Open source in eclipse. When try to debug getting an error connection refused . Plz help me
  • 6. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    Hello,
    I tried your solution but there is no catalina.bat file in the bin directory of tomcat. I'm using tomcat 6.0. I don't know how to fix this problem. The following is the code which I've used to define a servlet class:

    import java.io.File;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.UUID;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    import com.oreilly.servlet.MultipartRequest;

    @SuppressWarnings("serial")
    public class UploadServlet extends HttpServlet {
         private     UUID randomUUID;
         private HttpServletRequest request;
         private HttpServletResponse response;
         private boolean success;
         
         public String uploadServlet(String name,Object data){
              
              //renaming into uuid format:
              name=renameToUUIDformat().toString();
              request.setAttribute(name, data);
              
              try {
                   doPost(request, response);
                   success=true;
              } catch (ServletException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   success=false;
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   success=false;
              }
              
              //returning the renamed file.
              if(!success)
                   return null;
              else
                   return name;
         }
         
         public UUID renameToUUIDformat(){
              randomUUID = UUID.randomUUID();
              return randomUUID;
         }
         
         public void doPost(HttpServletRequest request,HttpServletResponse response)
              throws ServletException,IOException{
              //TODO : store into the file system
              @SuppressWarnings("unused")
              File dataFile;
              String filePath="http://localhost:8080/FileSystem";
              MultipartRequest multi=new MultipartRequest(request,filePath,5*1024*1024*1024);
              Enumeration filenames=multi.getFileNames();
              String elementName;
              while(filenames.hasMoreElements()){
                   elementName=(String)filenames.nextElement();
                   dataFile=multi.getFile(elementName);     
              }
              
         }
         
    }

    Any ideas?
    Thanks

    Message was edited by:
    setareh
  • 7. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    start "Configure Tomcat". Go to Java tab. add the following 2 lines.
    -Xdebug
    -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
    Then go to Startup tab and add the following two lines in the arguments entry box.
    jpda
    start
  • 8. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    eclipse - 3.3
    tomcat- 5.5
    for above versions i m getting below error when i try to debug.
    **Failed to connect to remote VM. Connection refused**


    is there any idea?

    Edited by: swoonna on Oct 24, 2007 1:37 AM
  • 9. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    Hi,I have the same problem.

    I first dubug is no error,but next time dubug is false

    you can see tomcat jpda is good working at 8000 port .use netstat -nat at linux

    if connect success ,netstat will change
  • 10. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    This works great for me except that I also had to set the port by default tomcat wasn't using 8000 but 1100 - maybe I have a newer version of tomcat. Setting the variable JPDA_ADDRESS in catalina.bat from JPDA_ADDRESS=jdbconn to JPDA_ADDRESS=8000 seemed to do the trick. I guess I could have also just changed the port eclipse was connecting to in the debug options too.

    Cheers Alistair
  • 11. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    Check if you have another debug session open. If so then disconnect and re-try.
  • 12. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    Hi, I have one question to raise on this issue, when you say eclipse can run only @ port 8000. Where do we need to give the remote server's port details? Assume a server called x.y.com is available and the weblogic( 2 instances) runs @ port 8040, and 8030 also. If this is the setup I have then how does eclipse know which server to debug which is running in 8040 & 8030 also.

    Thanks
  • 13. Re: Failed to connect to remote VM. Connection refused
    843798 Newbie
    Currently Being Moderated
    *Remote Debugging with Eclipse and Tomcat/BlazeDS
    -------------------------------------------------------------------------------*

    Edit Catalina.bat
    change
    set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx512m
    to
    set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx512m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y

    When you start tomcat in console, you can see this message.
    Listening for transport dt_socket at address: 8000

    Tomcat won't start running further and load web application deployed, until you debug application in eclipse.

    Now, you can remotely debug.

    Note:
    If you use suspend=n, then you can't remotely debug
    If you use suspend=y, then you can remotely debug


    *Remote Debugging with Eclipse and Jetty
    -------------------------------------------------------------*

    For example, jetty installation path is C:\jetty

    -> cd C:\Jetty
    -> java -Xms256m -Xmx512m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y -jar start.jar

    Now your jetty server listen for port 8000.
    You can able to debug with eclipse


    If you don't want to do remote debugging, just change suspend=y to suspend=n.
  • 14. Re: Failed to connect to remote VM. Connection refused
    791266 Explorer
    Currently Being Moderated
    I'm now locking this zombie thread.

    Kaj