How to debug JS running in Tomcat


I have some web pages that are generated from JSP files and served on Tomcat. I need to debug the JavaScript contained on those pages and can't figure out how to do it.

When I search for info on that, I find hints on how to:

  • Debug Java servlets running in Tomcat (I am already able to do that)
  • Debug static JavaScript files that can be loaded directly from the file system

But I don't see anything about debugging JavaScript contained in pages that are generated by the Tomcat server (in this case, from JSP pages).

Note that I am already able to debug Java servlets by creating a Tomcat server in intelliJ and running it in debug mode. When I do that, I can put breakppoints in my Java code and intelliJ will stop there when I do something in Chrome that ends up invoking that line. But if I put a breakpoint in a JavaScript file, intelliJ does not pause there.

Comment actions Permalink

Tomcat run configuration has "With JavaScript debugger option".

Once connected, you can see the scripts loaded in Chrome and place the breakpoints in these scripts:

Comment actions Permalink

Thx Serge, that did the trick!


Please sign in to leave a comment.