Debugging Tomcat does not stop at breakpoints
Answered
I run Tomcat from IDEA run config, using an artifact configured within IDEA. I have breakpoints set. When running in debug mode, it never stops at the breakpoints. Standard processes started from main method do stop at breakpoints. I don't have breakpoints muted.
I saw this with 2020 and 2018 versions of Intellij.
Tomcat: 8.5.15
Java: 1.8.0_181
This used to work for years with the same code, same run config back when I was running Intellij 2018 or earlier and Tomcat 8.0. However, I can't run that combination anymore to prove it still works because I get some new error regarding loading a jar file and annotations.
Please sign in to leave a comment.
What's the specific error? Could you please share a sample project and provide the exact steps to reproduce the issue?
There is no error. It just doesn't stop at the breakpoint.
It would not be feasible to provide a sample project for a Tomcat CXF soap service that is sharable. Breakpoints work for basic simple java code. I wouldn't even know where to begin to create a sample project using CXF soap and tomcat. If there is no other way to analyze this, I'll have to consider switching to Eclipse. This is an urgent issue for us.
You can try checking the Java Debugger logs to see if there anything reported: https://intellij-support.jetbrains.com/hc/en-us/articles/207241125 .
Make sure the code on the server corresponds to the sources in the IDE. There could be some jar deployed with the different code version that overrides your sources.
I'm experiencing the same problem,
In my case it's very frustrating because I come from Eclipse, hoping to find a better support for debbuging. After spending days configuring and trying to figure out how to work with IntelliJ, now I find that debug support is buggy :(.
It's not that it never stops on breakpoints, but that maybe in half of debugging session attempts it works, and doesn't on the other half. Very frustrating, because, as you may understand, you have to wait a considerable amount of time until the server starts.
Oh, and another issue, not exactly the same but probably related, is that when I run/debug, I always get a dialog stating that "Cannot open URL. Please check this URL is correct:", with the one I specified in the run configuration, which, of course, if I copy&paste on my browser, works.
A sample project to reproduce would be appreciated: https://uploads.jetbrains.com.
I don't think it's worth the time and effort to try to create a project for a CXF soap service to try to duplicate, because I very much doubt I would be able to. The issue is probably something specific to my project (either an issue with my setup or an edge case that exposes a defect in IDEA). I am almost certain I would not be able to pinpoint the correct scenario in a sample app through trial and error, which is why I was asking for help.(My service is buried in a huge project with 18,000 files, dozens of other services, many shared components, and over 400 external dependencies.)
It was suggested above to collect output from IDEA at the console. The following is what was written to the console. Is this helpful? (This is all of the console messages.)
2020-09-10 11:25:26,757 [ 6586] WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=org.jetbrains.android.compose.AndroidComposeAutoDocumentation)
2020-09-10 11:25:29,947 [ 9776] WARN - tartup.impl.StartupManagerImpl - Activities registered via registerPostStartupActivity must be dumb-aware: org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent$projectOpened$1@9c0f19
2020-09-10 11:25:36,243 [ 16072] WARN - com.intellij.util.xmlb.Binding - no accessors for org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider
2020-09-10 11:26:02,204 [ 42033] WARN - ion.impl.NotificationCollector - Notification group 'Heap Dump Analysis' is already registered in whitelist
2020-09-10 11:26:02,205 [ 42034] WARN - ion.impl.NotificationCollector - Notification group 'Low Memory' is already registered in whitelist
2020-09-10 11:26:54,342 [ 94171] WARN - ntellij.ui.tree.AsyncTreeModel - invalid node: Tomcat - Biometric (vue-cxfservices-biometric.war)
This output is not helpful, you may have better luck getting debugger logs and analyzing them to see why the breakpoints are not hit. Also try debugging with the command line jdb when the war is deployed outside of the IDE and see if the issue is still reproducible. https://intellij-support.jetbrains.com/hc/en-us/articles/207241125.
i think your local tomcat configurations files overides Idea`s JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:44417,suspend=y,server=n