'IntelliJ IDEA 2017.1 does not stop on breakpoints

I have an old Gradle project that I've opened recently using the new IDEA 2017 and I have just noticed it will not stop on breakpoints anymore (these are active, but not "validated" - no checkmark on them.

The code is run locally (a gradle run/debug config without any options) with bootRun as the gradle task.

I have tried an Invalidate Caches/Restart without any success. I have also tried re-importing the project in IDEA.

A while back I had the same issue after upgrading to Spring 1.4.5 (if I remember correctly). I couldn't figure out why, so I downgraded back to 1.4.2 and everything worked fine. However, this time I'm running Spring 1.2.4 and I cannot upgrade to a newer version without changing some code (and I don't want that yet)



Solution 1:[1]

Well... for some reason, creating a Gradle run/debug config would make it connect to the wrong port (something random over 50000) while the application was running on 8080.

Anyway, long story short, creating an Application run/debug config solved the issue and everything works fine now.

Solution 2:[2]

Confirm. Problem was that I try to debug using maven run configuration. Switching to Application configuration type helps. I've spend half of a day on it (

Solution 3:[3]

I have faced this problem.

  1. Invalidate caches and restart
  2. I was using Spring Boot rest api project in intellij so all debug breakponts were getting passed/ignored. But the programm started debug process whenI hit Api using postman

Solution 4:[4]

This problem happens due to different reasons and you could find some of the answers on Intellij Community pages.

That being said, one of the most common reasons are build plugins. If you really don't need the build plugins you could disable them and try again:

enter image description here

Solution 5:[5]

Although 2017.1 is long past this is the top answer for "intellij debugger not stopping at breakpoint java" so I'll add another tricky way to have this problem here and associated solution.

Another way to cause this is to set your gradle settings to run tests with gradle, and also have a configuration for your tests that does something like:

  doFirst {
    jvmArgs = [
        '--add-modules', 'ALL-MODULE-PATH',
        '--add-opens', 'java.base/java.lang.module=ALL-UNNAMED',
        '--add-opens', 'java.base/jdk.internal.loader=ALL-UNNAMED',

The mistake here is that this replaces ALL jvm args with the ones supplied including the args that IntelliJ passes to open the debugger port. The fix is just one character... use += instead of = like this:

  doFirst {
    jvmArgs += [
        '--add-modules', 'ALL-MODULE-PATH',
        '--add-opens', 'java.base/java.lang.module=ALL-UNNAMED',
        '--add-opens', 'java.base/jdk.internal.loader=ALL-UNNAMED',

Solution 6:[6]

The problem for me was that I was using bootrun as the command in Intellij's Gradle run config, instead of bootRun. Weirdly the application did start with the former, but it would not stop on any breakpoints. After switching to bootRun, breakpoints immediately started working.

Solution 7:[7]

If you are calling a rest api make sure the passed in param has the same fields as the param variable as shown here @PostMapping("/user") public ResponseEntity<?> updateUserProfile(@RequestBody UserDTO userDto) {

The passed in value for UserDTO obj should have the same instance variables list in the json passed.... also object reference from repos also should be checked.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CatalinM
Solution 2 Andriy Yarish
Solution 3 Abhinov Gogoi
Solution 4 Zstack
Solution 5 Gus
Solution 6
Solution 7 user1419261