Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Remotely debug your app in Eclipse

Levent Gurses has a nice blog entry on Remote Debugging with Eclipse. I was able to use his instructions a couple months ago to attach to a remote instance of WebLogic (8.1 SP4) to debug an application. The beauty of his instructions is I had it all working in about 5 minutes. Yesterday I realized you could use the settings in *any* application server, and remotely debug it - or at least you should be able to. Today I noticed he added instructions for Tomcat and JBoss. Good stuff - thanks Levent!

Here's the settings you need in your startup script - just in case Levent's blog is down the next time I need this info.

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044

Posted in Java at Dec 02 2005, 11:04:19 AM MST 20 Comments
Comments:

Matt, let me tell you a secret. Actually you can debug not only any app server but *any Java application*. :-)

This is insulting, but most of the people have no clue about this, even so it is been in Java almost from the beginning and all Java IDE support it.

http://jroller.com/page/eu?entry=debugging_any_application_with_eclipse

Posted by eu on December 02, 2005 at 07:39 PM MST #

Are you serious? How did you develop your app without remote debugging :)

Posted by D on December 02, 2005 at 10:17 PM MST #

Thanks Eu - good to know. I guess I'm a little behind the times.

D - tests my friend, lots and lots of tests. ;-)

Posted by Matt Raible on December 02, 2005 at 10:21 PM MST #

Matt, do you know how to setup Tomcat for debugging when running under the Windows NT/XP service wrapper that ships with Tomcat? I was looking for this yesterday and can't find information anywhere.

Posted by Jeff Sheets on December 02, 2005 at 11:15 PM MST #

Jeff - my guess is you should be able to put these settings into a CATALINA_OPTS environment variable. However, I tried this (as well as JAVA_OPTS) with Tomcat 5.5.12 and it doesn't seem to work. :(

Posted by Matt Raible on December 03, 2005 at 12:12 PM MST #

Whoa, this post is astounding. Not trying to be insulting, but it's always hard to believe people with real hands-on java experience don't know about this stuff (or never mind that, if they see an example for one environment don't realize that the same technique will work for any app server where you have some mechanism to get at the vm params; the VM is the VM after all.) JPDA has been around since something like 1999. Before JPDA there was another (somewhat crappier, hence the need for JPDA) standard for attaching to the VM. But you're not alone, as EU says... I just don't know how any developer could do their job without getting into the debugger for some problem cases and attaching to their app. It's such a time saver. System.out.println() I guess :-)

Posted by Joe on December 03, 2005 at 01:36 PM MST #

Wow, Matt ;-) This is really cold coffee isnt it? I mean, i am debugging applications remotely via JPDA since a few years actually ;-) Right now the most fun is to use JPDA with the Java5 beta JDK from IBM, its nice how easy it is to crash the complete VM by invoking the debugger...

Posted by Marc Logemann on December 03, 2005 at 08:48 PM MST #

I added support for remote debugging appfuse with any appserver using JPDA. (http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuseDebug). For ease of use, I used a shared memory address with name <project_name>-debug which would be the same instead of a socket port.

Posted by Sanjiv Jivan on December 04, 2005 at 03:06 PM MST #

Thanks for the heads up, Matt! I got mine up in 5 mins. Really saves me a lot of time in my debugging efforts. :)

Posted by James Lee on December 05, 2005 at 02:59 AM MST #

Hey Matt, Another cool trick "-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y". With the suspend flag set to 'y' the process will wait for a debugger connection and won't run until your debugger is attached and tells the process to go. I've been using this little trick a lot lately to figure out why my tests are not running from maven 2. To do that set MAVEN_OPTS equal to the debugging string. So when maven starts up it waits for my debugger to tell it to go, I attach with a remote debugging session from Eclipse with breakpoints set in my test code. When the test code is hit I can step through it to find out whats up. Very nifty...

Posted by Bill Dudney on December 05, 2005 at 04:47 AM MST #

If you dicovered JPDA debugging just recently, then you might want to test another nice thing: I belive I read somewhere you also use IDEA, and remote debugging works the same there. But it also supports hotswapping changed code, so if you notice a small bug during debugging, you can just correct it, hit Ctrl-Shift-F9 and load the changes into the running app. It already saved me a lot of time ...

Posted by Rene Gielen on December 05, 2005 at 09:39 AM MST #

Hi Matt, I have been using Eclipse remote debugging features enabled by JDPA with pleasure for some time ,until recently came accross very weard situation in the form of following message while trying to boot up JBOSS with JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=n,suspend=n
Error [2] in connect() call! err:: No such file or directory Socket transport failed to init. Transport dt_socket failed to initialize, rc = -1. FATAL ERROR in native method: No transports initialized
Greateful for any information regarding the issue
BR Pasi

Posted by Pasi Shemeikka on December 28, 2005 at 01:09 PM MST #

I have the same question as Matt did, but no one answer the question here. Since Tomcat 5.5 (windows) don't have the batch file like startup.bat, shutdown.bat, tomcat.bat, all the talking about JPDA here is not an answer for this specific question. Did anyone have the clue of how to support the remote debug from Eclipse to debug the tomcat (servlet), thanks again.

Posted by dragondad on January 06, 2006 at 04:56 PM MST #

Hi dragondad, you are not alone.. i'm also facing the same problem for tomcat5.5 12 (windows version). For earlier version, i'm doing it through batch file. But now no clues. Tried a few by attempt to set the environment variable but all failed.

Posted by PS on January 25, 2006 at 12:04 AM MST #

Well, regarding this, an idea came to me today. I simply copy the batch file from tomcat 4.1 to tomcat 5.5 and run the startup.bat which have the jpda configure. tomcat 5.5 run successfully and i can now connect to debug port from eclipse 3.1.

Posted by Poh Soon on January 26, 2006 at 05:29 PM MST #

For those on Windows 5.5+, here's the solution that worked for me, although I'm running as a service. 1. First, add these two environment variables: JPDA_ADDRESS=8000 and JPDA_TRANSPORT=dt_socket 2. Right click on the Tomcat system tray icon and hit "Configure..." 3. Under the Java tab, there's a "Java Options" box. Add: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n to the list. 4. Then just start your Eclipse debugger and tell it to point at localhost on port 8000. Hope that helps!

Posted by Ryan on June 27, 2006 at 03:20 AM MDT #

excuse i need your help so much i don't know how to debug wep application

when i sart to Remotely debug your app in Eclipse

i got this error

failed to connect to Remotr VM

what does this mean?

Note: my IDE is MyEclipse

Thnaks&Reagrds

Posted by essam abdel aziz on July 04, 2006 at 07:46 AM MDT #

Hi Matt, Thank you referring to my modest article. I updated portions of it with some new information and in the meantime I moved the article to its new home. If you do not mind I would like to update the article links to point to this new site:
Remote Debugging with Eclipse (Jacoozi Article)

Posted by Levent Gurses on September 28, 2006 at 06:36 PM MDT #

I faced the same "Error [2] in connect() call! err:: No such file or directory" problem.

First I added the following lines to "startup.bat":

SET JPDA_ADDRESS=8000 SET JPDA_TRANSPORT=dt_socket

Then I added the "jpda" keyowrd before the start parameter.

call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%

Everything looks fine this far... But it didn't work!

THE SOLUTION: There was simply a space character after the "8000"!!

The command assembled within the script was:
java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000 ,server=y,suspend=n
(There was a FU..... space behind the "8000"...)

After removing the space the command was correct: java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

Maybe someone should change the "catalina.bat" to make it remove unnecessary spaces with in parameters!?

Posted by Michael on November 13, 2006 at 07:59 PM MST #

www.jacoozi.com comes up as a website for sale?

And using Matt's startup string return VM connection refused.

Any ideas?

Posted by David Brown on November 28, 2012 at 04:25 PM MST #

Post a Comment:
  • HTML Syntax: Allowed