Search code examples
javadebuggingintellij-idea

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


Solution

  • Add the following parameter debug-enabled="true" to this line in the glassfish configuration. Example:

    <java-config  debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009" debug-enabled="true"
      system-classpath="" native-library-path-prefix="D:\Project\lib\windows\64bit" classpath-suffix="">
    

    Start and stop the glassfish domain or service which was using this configuration.