Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.| By Bill Dudney | Article Rating: |
|
| May 20, 2004 12:00 AM EDT | Reads: |
292,256 |
To view our full selection of recent Eclipse stories click here
Over the last several weeks I've received a few questions about remote debugging with Eclipse. I posted about this on my other blog back in February here but with not enough info for others to follow.
If you go look at that blog entry you will see that I looked into 'in eclipse' debugging but did not find it satisfactory.
So without further ado here is how I use Tomcat, JBoss, and Eclipse to build and debug applications.
Whichever platform you are using (Tomcat or JBoss) you need to start them with the JPDA debugging enabled. For Tomcat this is very easy. In the $CATALINA_HOME/bin directory there is a script catalina.sh. If you provide the arguments 'jpda start' tomcat will startup and listen on port 8000 for a debugger connection.
With JBoss its only slightly more complicated. Basically you need to specify the JAVA_OPTS to have java start up listening for debugger connections. I typically copy the $JBOSS_HOME/bin/run.sh to $JBOSS_HOME/bin/run-debug.sh but you can just as easily setup the JAVA_OPTS environment variable and use the run.sh script.
The value of JAVA_OPTS needs have -Xdebug -Xrunjdwp:server=y, transport=dt_socket,address=4142, suspend=n specified.
So this is what is going on with this argument list
- Xdebug == start the jvm and listen for debugging connections
- Xrunjdwp... == the info on how to connect to do remote debugging
- server=y == start in server mode (i.e. wait for connections, don't go out looking to connect
- transport=dt_socked == use sockets, this works (I think) only on unix (I'm on a mac), on Windows you have to use shared memory via the transport=dt_shmem argument instead. I'm fairly sure this works but its been a while since I tried it on Windows. YMMV. Here is the official info on the connection arguments
- address=4142 == the port to connect to or the shared mem address to use
- suspend=n == don't wait for a debugger to tell you what to do, go ahead and launch
Once you have JBoss or Tomcat running and listening for debugging connections you are good to go for connecting with Eclipse
The first thing you need to do is create a 'debug launch configuration' by bringing up the launch configuration editor. Figure 1 shows the menu item to invoke to make that happen
When the launch config editor appears select 'Remote Java Application' from the 'Configurations:' selection list on the left hand side then click the 'New' button. Figure 2 shows the defaults that appear for me after hitting the 'New' button.
Since it defaults to the Tomcat port leave the port number set to 8000, if yours is different then change it to 8000. Notice also that you can specify the host to connect to. If you have access to the port and the process is running on another machine then you can debug the process remotely. This works out really well for those situations where it works fine in your local env but not in the test env. I usually rename the configuration (it defaults to the name of the project for me) to 'Debug Tomcat' or something like that.
The other options (Source & Common) can be ignored for now. If you have not already launched tomcat in debug mode do so now on the command line with $CATALINA_HOME/bin/catalina.sh jpda start. When its launched go back to the Eclipe launch configuration editor and hit the 'Debug' button. If you are not auto switched to the'Debug' perspective go there now. You should see a 'Debug View' that looks a lot like Figure 3.
Your code should be directly below the Debug View if you have the default layout still in place. If so go there and set a break point in one of your servlets' service methods (or any other code that is being executed in Tomcat, like a struts action or whatever) and then go to the Web browser and tickle the code that you have a break point set in. Notice that Eclipse suspends Tomcat at the breakpoint, comes to the front and lets you debug your program. Everything works just as if you were debugging locally.
Everything works the same within JBoss once you get it started with the debugging turned on. Keep in mind that you must set the port to match (in the above discussion of JAVA_OPTS it is set to 4142). So you need to create a new Debug launch configuration and specify 4142 as the port. Then you can debug your EJBs.
If you'd like to know more about this or you are having trouble making it work feel free to comment or send me an email.
Happy Debugging!
Published May 20, 2004 Reads 292,256
Copyright © 2004 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
- Parasoft Jtest 5.0 Fully Integrated with Eclipse Platform
- Yet Another IDE War
- Eclipse Special: IBM Rational Update
- Eclipse Special: Eclipse in the News
- Eclipse Special: Milestone Build Now Available - Eclipse 3.0 M8
- Eclipse "Welcomes Open Dialog From Sun"
- Eclipse Special: LynuxWorks Introduces New Eclipse-Based IDE
- Eclipse Special: Bill Dudney Looks at Eclipse M8 Close-Up
- Eclipse Special: Bill Dudney Looks at the Change Method Signature Refactoring
- "Eclipse 3.0 is a Great Leap Forward," Says JDJ's Dudney
- ILOG Launches New Business Rule Studio for Eclipse
- SYS-CON Radio interviews the Eclipse Foundation
- Eclipse "Pollinate" Project to Integrate with Apache Beehive
- Exclusive Q & A with Mike Milinkovich, Executive Director, Eclipse Foundation
- Eclipse Special: Bill Dudney on the Web Tools Project
More Stories By Bill Dudney
Bill Dudney is Editor-in-Chief of Eclipse Developer's Journal and serves too as JDJ's Eclipse editor. He is a Practice Leader with Virtuas Solutions and has been doing Java development since late 1996 after he downloaded his first copy of the JDK. Prior to Virtuas, Bill worked for InLine Software on the UML bridge that tied UML Models in Rational Rose and later XMI to the InLine suite of tools. Prior to getting hooked on Java he built software on NeXTStep (precursor to Apple's OSX). He has roughly 15 years of distributed software development experience starting at NASA building software to manage the mass properties of the Space Shuttle.
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.Nov. 11, 2018 04:00 PM EST Reads: 3,170 |
By Pat Romanski Nov. 11, 2018 11:45 AM EST Reads: 2,273 |
By Elizabeth White Nov. 10, 2018 11:45 PM EST Reads: 2,064 |
By Pat Romanski Nov. 10, 2018 10:00 PM EST Reads: 3,206 |
By Pat Romanski Nov. 10, 2018 01:00 AM EST Reads: 2,941 |
By Pat Romanski Nov. 9, 2018 04:45 PM EST Reads: 2,282 |
By Yeshim Deniz Nov. 3, 2018 05:00 AM EDT Reads: 4,026 |
By Yeshim Deniz Nov. 2, 2018 03:00 PM EDT Reads: 3,210 |
By Elizabeth White In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential.
Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...Oct. 30, 2018 03:45 PM EDT Reads: 14,062 |
By Zakia Bouachraoui Oct. 30, 2018 11:45 AM EDT |

In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential.
Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...

Isomorphic Software is the global leader in high-end, web-based business applications. We develop, market, and support the SmartClient & Smart GWT HTML5/Ajax platform, combining the productivity and performance of traditional desktop software with the simplicity and reach of the open web.
With staff in 10 timezones, Isomorphic provides a global network of services related to our technology, with offerings ranging from turnkey application development to SLA-backed enterprise support.
Leading global enterprises use Isomorphic technology to reduce costs and improve productivity, developing ...
DevOps has long focused on reinventing the SDLC (e.g. with CI/CD, ARA, pipeline automation etc.), while reinvention of IT Ops has lagged. However, new approaches like Site Reliability Engineering, Observability, Containerization, Operations Analytics, and ML/AI are driving a resurgence of IT Ops. In this session our expert panel will focus on how these new ideas are [putting the Ops back in DevOps orbringing modern IT Ops to DevOps].
















