How-to: How-to: remote debug a Java-Service

How-To: How-To: Remote Debug A Java-Service​

Prerequisite:

  • A IDE with remote debugging capabilities. For the purpose of this guide, we shall use the IntelliJ IDE from Jetbrains.
  • WinScp installed. If not it will be possible to use a regular shell connection to perform the same job.
INTEGU - Remote debug Java service
  1. Within the IntelliJ IDE, Open the “Edit run configurations”-dialog.
  2. Find the “Remote JVM Debug” run configuration, which you would like to use (targeted at specific CWPs within the developer environment).
    Alternatively, create a new configuration for your purpose.
  3. Copy the content of the “Command line arguments for remote JVM”-field.
INTEGU - Edit run configurations

4. Open a WinSCP (…or any other connection tools, which you prefer) connect to the intended remote node.

5. Add the command line arguments (step 4) to the service or executable starting the jar. This could for example be a service-file, a docker container, or perhaps a manually fired  command (e.g. see below).

				
					/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n, address=*:5005 -jar service.jar
				
			

6. Consider if a port is open between the remote node and your debugging machine. If not, temporary disable the firewall. 

7. Start the run configuration from step 2 in debug mode. Debugging is now available on the remote Java-service.

8. When finished, remember to start up the firewall service again.

Recommended Reading

No references for this article…

About

Hi, I'm the Author

My name is Daniel H. Jacobsen and I’m a dedicated and highly motivated software developer with a masters engineering degree within the field of ICT. 

I have through many years of constantly learning and adapting to new challenges, gained a well-rounded understanding of what it takes to stay up to date with new technologies, tools and utilities. 

The purpose of this blog is to share both my learnings and knowledge with other likeminded developers as well as illustrating how these topics can be taught in a different and alternative manner.

If you like the idea of that, I would encourage you to sign up for the newsletter.

Cheers! 🍺

Didn't Find What You Were Looking For?

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Scroll to Top
INTEGU - Cookie-consent

INTEGU uses cookies to personalize your experience and provide traceability for affiliate links. By using the website, you agree to these terms and conditions. To learn more see the privacy policy page.