Breakpoints not hit when trying to do remote debug in IntelliJ - maven

I am running the following command on command prompt
mvnDebug cuke4duke:cucumber
and then trying to attach from IntelliJ to remote debug code.
I get the following messages in InteliJ but breakpoint's never get hit
Connected to the target VM, address: 'localhost:8000', transport: 'socket'
Disconnected from the target VM, address: 'localhost:8000', transport: 'socket'
Note - My code is not stale, it is upto date.

Related

Can't Connect to Minecraft Server When Remote Debugging With IntelliJ

The remote debugging is working, but when I have IntelliJ open and the remote debugging profile active, I'm not able to join the Minecraft server with my actual player at all (via localhost). When connecting, it simply says "Disconnected" and shows nothing in the console. I can, however, join the server before loading IntelliJ and using Remote JVM Debug afterwards but when I disconnect, I'm not able to log in again (other servers work fine). The server will not poll after IntelliJ has launched with the profile active (doesn't have to be debugging). I see no other errors anywhere.
Here's what I've tried:
Running JDK19 on server and client
Switching ports and using 127.0.0.1 instead
Using JAR Application configuration
Using Remote JVM Debug configuration
Disabling MacOS Firewall (since been re-enabled)
Other stuff I copied... might be useful:
IntelliJ Versions:
IntelliJ IDEA 2022.3 (Community Edition)
Runtime version: 17.0.5+1-b653.14 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Server Info/Device Info:
Connected to the target VM, address: '127.0.0.1:55637', transport: 'socket'
Starting org.bukkit.craftbukkit.Main
System Info: Java 19 (OpenJDK 64-Bit Server VM 19.0.1+10-21) Host: Mac OS X 13.1 (aarch64)
2023-01-28 16:21:45,022 ServerMain WARN Advanced terminal features are not available in this environment
Server Version:
[16:21:49 INFO]: This server is running Paper version git-Paper-381 (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT) (Git: 42fecd0)
Minecraft Client Log:
[15:32:04] [Render thread/INFO]: Connecting to localhost, 25565
[15:32:13] [Render thread/INFO]: Connecting to localhost, 25565
[15:33:29] [Render thread/INFO]: Connecting to localhost, 25565
Screenshot
I figured it out. For whatever reason, the "built-in server debugger" was already set to 25565. Not sure if I set that, but changing it to 25560 fixed the problem!
Settings > Build, Execution, Deployment > Debugger...Built-in Server

Debugger failed to attach: handshake failed - received >GET /api/domai< - expected >JDWP-Handshake<

I am trying to debug a basic Quarkus app by running the command ./mvnw compile quarkus:dev on IntelliJ (as stated in the Quarkus docs) and it seems to run ok (gives me the following message: Listening for transport dt_socket at address: 5005)
I can call the APIs on port 8080 and all fine but when I try to call the same API on port 5005 I get the following error Debugger failed to attach: handshake failed - received >GET /api/domai< - expected >JDWP-Handshake<.
I tried configuring a Remote Debug configuration as shown in the image but doesn't seem to work.
Does anyone know how to solve this?
One process can listen on multiple TCP/IP sockets for multiple things.
The debug port is the port 5005 where you attach the remote debugger to.
The API calls still need to go to port 8080, though. When you hit a breakpoint, you will see it in your debugger.

How to debug remote spring boot appliaction in IntelliJ Ultimate with gradle project tool

I am new to IntelliJ and gradle and I want to debug my Spring boot application remotely , request is coming from UI and I need to debug the request ,
But not getting success , tried many thing followed JetBrain site and also tried to configure the debug setup.
but I m really getting frustrated, I guess I am not starting server in debug mode or doing something wrong.
Could anyone tell me how to set up the configuration in IntelliJ with Gradle Spring project?
getting error like:
Unable to open debugger port (localhost:8082): java.io.IOException "handshake failed - connection prematurally closed"
Edit: do I need to do anything else , my app is running on 8082 port no.
I am running my app normally as I do via cmd line ./gradlew bootRun
Unless you made some modifications to the Gradle build configuration (which I doubt being the case since you mentioned being new to Gradle), you should be able to start you application with a debugger attached to it using the --debug-jvm flag:
$ ./gradlew run --debug-jvm
and since you are using Spring Boot, you should rather use the bootRun task:
$ ./gradlew bootRun --debug-jvm
Once above command fired, your application will start and you should see below line in output:
Listening for transport dt_socket at address: 5005
stating that the JVM debugger is waiting for a client to attach on port 5005 which should be the same as your IntelliJ IDEA | Remote JVM Debug configuration port. Change the port from 8082 to 5005 for your Store_Debug configuration then click on the 🐛 icon and you should see a message stating that your debugger is attached:
Connected to the target VM, address: 'localhost:5005', transport: 'socket'

How can I debug gradle plugin

I have written an andrioid gradle plugin with IntelliJ.And I used it in an Android application.I would like to debug the plugin.So I tried to create a remote debug in IntelliJ
Then do something in Android Studio.
Excute
export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
and
./gradlew showTips --no-daemon
.The result is the IJ debugger can connect to VM,but did not STOP at the breakpoint.
My plugin code is this
The resule in IJ is this ,and never stop at the breakpoint
Connected to the target VM, address: 'localhost:5005', transport: 'socket'
Disconnected from the target VM, address: 'localhost:5005', transport: 'socket'
What can I do to make the breakpoint to be useful
I think you also need to set a debug property for gradle. -Dorg.gradle.debug=true
org.gradle.debug
When set to true, Gradle will run the build with remote debugging enabled,
listening on port 5005. Note that this is the equivalent of adding
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
to the JVM command line and will suspend the virtual machine until a
debugger is attached.
https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

Debug gradle jettyRun in IntelliJ

I run Jetty from the command line with:
export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n"
gradle jettyRun
and see:
Listening for transport dt_socket at address: 9999
... then in IntelliJ Idea (Ultimate 12.1.3) I create a new remote debug configuration with all defaults, changing only the port to 9999.
When I start (debug) using the remote configuration, I see:
Connected to the target VM, address: 'localhost:9999', transport: 'socket'
... which makes me think everything is working as expected.
Then I make requests that should result in hitting breakpoints. But the breakpoints are never triggered.
What am I doing wrong?
Thanks.
You could have the "org.gradle.jvmargs" variable set in your gradle.properties file. This causes the JVM to be forked which means you are no longer debugging the right process.
In this case, you could either not set the "org.gradle.jvmargs" or pass it the debug parameters eg.
org.gradle.jvmargs=-XX:MaxPermSize=128m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1233
Setting the debug parameters in org.gradle.jvmargs would configure the forked process for debugging.
In IntelliJ (at least on 12.1.5) you can just go to JetGradle, right click on jettyRun and then click on Debug.

Resources