[java] Unable to open debugger port in IntelliJ

Unable to open debugger port in intellij. The port number 9009 matches the one which has been set in the configuration file for the application.

<java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009" system-classpath="" native-library-path-prefix="D:\Project\lib\windows\64bit" classpath-suffix="">
    <jvm-options>-XX:MaxPermSize=192m</jvm-options>
    <jvm-options>-client</jvm-options>
    <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>
    <jvm-options>-XX:+LogVMOutput</jvm-options>
    <jvm-options>-XX:LogFile=${com.sun.aas.instanceRoot}/logs/jvm.log</jvm-options>
    <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
    <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>
    <jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>
    <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>
    <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
    <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
    <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>
    <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options>
    <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>
    <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
    <jvm-options>-Dosgi.shell.telnet.port=4766</jvm-options>
    <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>
    <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>
    <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>
    <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>
    <jvm-options>-Dfelix.fileinstall.debug=1</jvm-options>
    <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>
    <jvm-options>-Dorg.glassfish.web.rfc2109_cookie_names_enforced=false</jvm-options>
    <jvm-options>-XX:NewRatio=2</jvm-options>
    <jvm-options>-Xmx2048m</jvm-options>
  </java-config>

Configuration in IntelliJ:

enter image description here

When I try and enable the remote debugging in for this application it comes up with the following error: enter image description here

This question is related to java debugging intellij-idea

The answer is


You may have to change the debugger port if your port is already used by another program. To do so:

  • Run
  • Edit Configurations
  • Startup/Connection tab
  • Debug
  • Change the port here

Or, maybe in other versions:

  • Run
  • Edit Configurations
  • Remote > Remote debug in the list on the left
  • Configuration tab, Settings section
  • Port: change the port here

I'm hoping your problem has been solved by now. If not, try this... It looks like you have server=y for both your app and IDEA. IDEA should probably be server=n. Also, the (IDEA) client should have an address that includes both the host name and the port, e.g., address=127.0.0.1:9009.


  1. In glassfish\domains\domain1\config\domain.xml set before start server:

_x000D_
_x000D_
      <java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n" java-home="C:\Program Files\Java\jdk1.8.0_162" debug-enabled="true" system-classpath="">
_x000D_
_x000D_
_x000D_

or set debug-enabled="true" server=y,suspend=n in http://localhost:4848/common/index.jsf Glassfish 4 address=9009,server=y,suspend=n

  1. In current Idea 2018 - Server Run Configuration - Debug - Port - address Server Run Configuration - Debug - Port - address

Merely hitting the debug icon again fixed my problem in a few seconds.


For me, the problem was that catalina.sh didnt have execute permissions. The "Unable to open debugger port in intellij" message appeared in Intellij, but it sort of masked the 'could not execute catalina.sh' error that appeared in the logs immediately prior.


Try to connect with telnet , if it connects then it shows below:

$telnet 10.238.136.165 9999 Trying 10.238.136.165... Connected to 10.238.136.165. Escape character is '^]'. Connection closed by foreign host.

If port is not available (either because someone else is already connected to it or the port is not open etc) then it shows something like it shows like below:

$telnet 10.238.136.165 9999 Trying 10.238.136.165... telnet: connect to address 10.238.136.165: Connection refused telnet: Unable to connect to remote host

So I think one needs to see whether:

  • the application is property listening to port or not

  • or someone else has already connected to it

Also try to connect on that m/c itself first like $telnet localhost 9999


This one worked for me-- If the issue still persists (in case you are not using a glassFish server), then close your JIdea and stop the server. This will disable the ports connectivity. Then start your server and JIdea, this will start fresh connectivity with the ports, resolving the issue.


Set the MAVEN_OPTS. It should work !!

export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

mvn spring-boot:run -Dserver.port=8090


Answer is pretty simple, I also faced the problem finally I got perfect solution. Create Debug Create Remote debug with following configuration Firstly run by debug. It gives you waitng for socket 5005 then run with remote debug


I once have this problem too. My solution is to work around this problem by kill the application which is using the port. Here is a article to teach us how to check which application is using which port, find it and kill/close it.


I had the same problem and this solution also did the trick for me: Provide the IP 127.0.0.1 in the Intellij Debug configuration instead of the host name "localhost", in case you're using this hostname.


This error can happen Tomcat is already running. So make sure Tomcat isn't running in the background if you've asked Intellij to start it up ( default ).

Also, check the full output window for more errors. As a more useful error may have preceded this one ( as was the case with my configuration just now )


I had the same issue, I just have to remove the HTTP protocol from the URL. That's it.

I hope it works for you.


Your Service/ Application might already be running. In Search enter Services and you will get list of services. Stop yours and then try again.


Run your Spring Boot application with the given command to enable debugging on port 6006 while the server is up on port 8090:

mvn spring-boot:run -Drun.jvmArguments='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=6006' -Dserver.port=8090

You must set CHMOD +x (execute for *.sh or *.bat files). For example, I am using macOS

cd /Users/donhuvy/Documents/tools/apache-tomcat-9.0.12/bin
sudo chmod +x *.sh

Then IntelliJ IDEA, and Apache Tomcat running or debugging just good.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to debugging

How do I enable logging for Spring Security? How to run or debug php on Visual Studio Code (VSCode) How do you debug React Native? How do I debug "Error: spawn ENOENT" on node.js? How can I inspect the file system of a failed `docker build`? Swift: print() vs println() vs NSLog() JavaScript console.log causes error: "Synchronous XMLHttpRequest on the main thread is deprecated..." How to debug Spring Boot application with Eclipse? Unfortunately MyApp has stopped. How can I solve this? 500 internal server error, how to debug

Examples related to intellij-idea

IntelliJ: Error:java: error: release version 5 not supported Has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error: Java: invalid target release: 11 - IntelliJ IDEA IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 ERROR Source option 1.5 is no longer supported. Use 1.6 or later Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 How to configure "Shorten command line" method for whole project in IntelliJ intellij idea - Error: java: invalid source release 1.9 Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle