I understand that this is possible to do with the Ultimate Edition, but is there a way to debug these applications locally in the Community Edition?
If you have worked with IntelliJ Ultimate edition you have seen that it is possible to add a Tomcat configuration where you can both debug or run your Tomcat container from within IntelliJ. It is possible to get your IntelliJ Community version to do the same thing for you with a little bit of extra settings.
This is a remote monitoring and management tool for Tomcat. JMX related settings is not needed to enable your debugging. Although it can be useful for monitoring purposes through JConsole (read more).
You instance of Tomcat must be already up and running for the Community version to be able to attach itself to the Tomcat process. While your tomcat will be running on a port (Tomcat default is 8080), you also need to setup another port for the debugger to attach itself to your running version of Tomcat (9999 in our example).
Settings include changes you need to make to your Tomcat and configurations you need to do on your IntelliJ community edition.
Please follow the order in changes.
Stop your Tomcat if it is running in your Tomcat bin folder through: ./shutdown
or ./catalina stop
Add the following line to your catalina.sh file under the commented JAVA_OPTS set statement:
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999"
HINT: I have used
JAVA_OPTS
notCATALINA_OPTS
as the comments in catalina.sh suggests it is preferred to useJAVA_OPTS
. However, it is possible to useCATALINA_OPTS
in a similar manner to enable the debugging.
./catalina.sh start
After click on debug button in your IntelliJ Community edition your debug section should open with the following line in its Console area:
Connected to the target VM, address: 'localhost:9999', transport: 'socket'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With