Search code examples
javadebuggingintellij-ideaaemremote-debugging

Connection Exception in IntelliJ IDEA for AEM


I am trying to set up debug configurations in IntelliJ IDEA for AEM project. I am using 2016.3.3 version. I did changed the correct port number in debug configuration and message the connected message. Example - 'Connected to the target VM, address: 'localhost:30303', transport: 'socket'.

Now when I am trying to debug my code: Run - Debug- Remote Debugger. I am getting this error.

Error running Remote Debugger: Unable to open debugger port (localhost:30303): java.net.ConnectException "Connection refused: connect"

Can anyone suggests whats wrong here. Thanks in advance


Solution

  • Seems some other application(or may be the same config) is already connected to your env on this port. Supper easy way to fix this issue it is restart of AEM env(you don't need to figure out which app is using debug port).

    You can also check your startup script which should be similar to:

     java -Xmx3072m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=30303,suspend=n -jar aem-6.2.0.jar  -nofork -p 4502
    

    and IDEA config setup in the .idea/workspace.xml: inside of <component name="RunManager" tag configuration should be like:

      <configuration default="false" name="30303" type="Remote" factoryName="Remote">
        <option name="USE_SOCKET_TRANSPORT" value="true" />
        <option name="SERVER_MODE" value="false" />
        <option name="SHMEM_ADDRESS" value="javadebug" />
        <option name="HOST" value="localhost" />
        <option name="PORT" value="30303" />
        <RunnerSettings RunnerId="Debug">
            <option name="DEBUG_PORT" value="30303" />
            <option name="LOCAL" value="false" />
        </RunnerSettings>
        <method />
      </configuration>