• +94712452807
  • pubudu2013101@gmail.com
  • No 39, 2nd Lane, Dikhenapura, Horana
Docker: How to remote debug tomcat docker container

Docker: How to remote debug tomcat docker container

This is very simple task. I will use IntelliJ idea as my IDE. If you are reading this article you should work with docker and you might familiar with that. Because of that i won’t explain the part of creating a docker container.

First thing you need to do it to add following environment variables.

-e JPDA_ADDRESS=8000 \
-e JPDA_TRANSPORT=dt_socket 

Then you need to run tomcat container with jpda parameter. So full docker run script can be like below

docker run -it --rm \
  -e JPDA_ADDRESS=8001 \
  -e JPDA_TRANSPORT=dt_socket \
  -p 8080:8080 \
  -p 8001:8001 \
  tomcat:8.0 \
  /usr/local/tomcat/bin/catalina.sh jpda run

Now your tomcat container is started in debug mode. Now you need to open the application in IntelliJ which is running on the container and set a debug point to somewhere.

Open the run/debug configuration window. Then click + and select remote. Now add the host and JPDA port and click apply. Finally click the debug icon then you will be able to debug you application.

Sometimes you will get this error.

Debug: Unable to open debugger port ( java.net.ConnectException “Connection refused”

This happens because your jpda port is not exposed to outside of the container or else you didn’t run docker container with jpda run.

Hope you enjoyed today lesson. Thank you for reading this. Don’t forget to put a comment if you have any issue

7 thoughts on “Docker: How to remote debug tomcat docker container

    • Author gravatarAuthor gravatar

      You can certainly see your enthusiasm in the article you write.
      The world hopes for more passionate writers like you who are not afraid to say how they
      believe. At all times go after your heart.

    • Author gravatarAuthor gravatar

      Hey would you mind letting me know which web host you’re using?

      I’ve loaded your blog in 3 completely different internet browsers and
      I must say this blog loads a lot quicker then most.
      Can you suggest a good hosting provider at a fair price? Many thanks, I appreciate it!

    • Author gravatarAuthor gravatar

      Do you have any video of that? I’d want to find out
      more details.

    • Author gravatarAuthor gravatar

      Thanks for sharing your thoughts on website. Regards

    • Author gravatarAuthor gravatar

      Your style is very unique compared to other folks I have read stuff from.
      I appreciate you for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

    • Author gravatarAuthor gravatar

      This is really interesting, You’re a very skilled blogger.
      I’ve joined your feed and look forward to seeking more of your excellent post.
      Also, I’ve shared your website in my social networks!

    • Author gravatarAuthor gravatar

      Hello! I’ve been following your weblog for a while now and
      finally got the bravery to go ahead and give you a shout out from Lubbock
      Tx! Just wanted to mention keep up the great work!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: