The i-Technology Media!
Register | Log in
   
 
.NET  ·  AJAX  ·  CLOUD  ·  ECLIPSE  ·  FLEX  ·  OPEN WEB  ·  iPHONE  ·  JAVA  ·  LINUX  ·  OPEN SOURCE  ·  ORACLE  ·  PBDJ  ·  SEARCH  ·  SILVERLIGHT  ·  SOA  ·  VIRTUALIZATION  ·  WEB 2.0  ·  WIRELESS  ·  XML
Comments
Drool, Britannia? Is the UK Failing the Cloud?
By Roger Strukhoff
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Jan. 8, 2012 11:38 AM EST
read more & respond »
Cloud Expo on Google News
Did you read today's front page stories & breaking news?

Cloud Expo & Virtualization 2011 West
Keynotes
Oracle
Opening Keynote | An Enterprise Cloud for Business-Critical Applications
Abiquo
Day 2 Keynote | The Enterprise Cloud Tightrope - Balancing for Success
Akamai
Day 3 Keynote | The DNA of an Enterprise Cloud
DIAMOND SPONSOR:
Oracle
Many Clouds, Many Choices'Cloud
PLATINUM PLUS SPONSORS:
Abiquo
Enterprise Cloud Best Practices - Town Hall - Join the discussion…
PLATINUM SPONSORS:
Intel
Progressing Toward the Federated, Automated and Client-Aware Cloud
New Relic
How to build an app with Twitter-like throughput
Rackspace
Computing in the Cloud Era
GOLD SPONSORS:
Gale Technologies
Practical Cloud Migration
IBM
Re-think IT. Re-inventing Business.
Intel/McAfee
Identity Driven Security in the Cloud
PerspecSys
Hackers Hackers Everywhere, Is My Public Cloud That Safe?
Red Hat
Unlock the Value of the Cloud
SHI
Mission Critical Applications and the Cloud - Myth or Reality?
SoftLayer
Not Your Grandpa's Cloud
Terremark
Integrating Enterprise Clouds
VMware
Upgrade to a vCloud
POWER PANELS:
Cloud Expo Silicon Valley: CTO Power Panel
Cloud Expo Silicon Valley: CEO Power Panel
Cloud Expo Silicon Valley: Cloud SuperStars Panel
Cloud Expo Silicon Valley: CloudNOW Panel
Click For 2010 West
Event Webcasts
Cloud Expo & Virtualization 2011 East
DIAMOND SPONSOR:
Dell
Dell & VMware Deliver the Enterprise Hybrid Cloud
PLATINUM PLUS SPONSORS:
Abiquo
Are Financial Services Organizations Risking Security by Avoiding Cloud Computing?
Oracle
From Consolidation to Enterprise Private PaaS
PLATINUM SPONSORS:
Intel
Driving the Transformation to Next Generation Cloud Data Centers
Rackspace
The Inevitability of an Open Cloud
GOLD SPONSORS:
CA Technologies
Follow YOUR path to Cloud Computing
Interxion
Who Keeps the Cloud in the Air?
Microsoft
Patterns for Cloud Computing
PerspecSys
War in the Clouds: Are you ready?
ServiceMesh
The Big Win: Stop Playing Small-Ball with Your Cloud Strategy
Terremark
Evaluating Enterprise Clouds
Xiotech
Cloud Storage: Myths and Realities
POWER PANELS:
Cloud Expo New York: CTO Power Panel
Cloud Expo New York: CEO Power Panel
Cloud Expo New York: CMO Power Panel
Cloud Expo New York: Wrap-Up Power Panel
Click For 2010 West
Event Webcasts
Live Google News by SYS-CON!
Top Three Links You Must Click On


Features
Eclipse Special: Remote Debugging Tomcat & JBoss Apps with Eclipse
So without further ado here is how I use Tomcat, JBoss, and Eclipse to build and debug applications

By: Bill Dudney
May. 20, 2004 12:00 AM

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 242,033 — Feedback 32
Copyright © 2004 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
Related Stories
▪ 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 Special: Bill Dudney Looks at New Stuff in M9
▪ "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
Related Links
▪ Figure 1
▪ Figure 2
▪ Figure 3
▪ Eclipse 3 Live (book by Bill Dudney)
About 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.

Add Your Feedback

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 3

#32
david commented on 23 Jan 2008

see link

#31
Srikanth commented on 30 Aug 2007

Thanks A lot....

#30
Manju commented on 14 Aug 2007

This was very helpful. The information is just right

#29
Pasi Shemeikka commented on 28 Dec 2005

Hi Bill Dudney,

I really enjoyed reading your blog on Remote Debugging Tomcat & Eclipse Apps with Eclipse.

I would have one problem regarding remote debugging with Jboss as after editing the run.bat JAVA_OPTS section and setting the debug_port I came across very weard looking error message about not been able to initialize dt_socket.

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 initialize

I'm using
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_
Java HotSpot(TM) Client VM (build 1.4.2_10-b03)

I appreciate your advice

Best Regards

Pasi

#28
Pasi Shemeikka commented on 28 Dec 2005

Hi Bill Dudney,

I really enjoyed reading your blog on Remote Debugging Tomcat & Eclipse Apps with Eclipse.

I would have one problem regarding remote debugging with Jboss as after editing the run.bat JAVA_OPTS section and setting the debug_port I came across very weard looking error message about not been able to initialize dt_socket.

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 initialize

I'm using
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_
Java HotSpot(TM) Client VM (build 1.4.2_10-b03)

I appreciate your advice

Best Regards

Pasi

#27
Xingsheng commented on 31 Aug 2005

Hi Bill,

When I try to use the eclipse to do a remote debug on a web app on tomcat, I got "Failed to conne`t to remote VM. Connection refused". Any insight on this issue?

THanks!
Xingsheng

#26
manoj commented on 10 Apr 2005

how to do tomcat application server debugging torugh visual slick editor

#25
manoj commented on 10 Apr 2005

i want to do remote tomcat application server debugging through
visual slick edit
can u give some info in this context

#24
Evandro Agnes commented on 1 Sep 2004

It is possible multiple developers debug the application at the same time?

In my environment, the first developer works fine. When the second developer tries to debug the following message appears: Failed to connect to remote VM.

Sorry for english!

#23
mahesh adepu commented on 11 Aug 2004

Hi,
I can able to debug java code of my webapplication from eclipse.My web application using jsp,struts,castor.How to debug struts & jsp.
Thank you.
mahesh

#22
mahehs adepu commented on 9 Aug 2004

Jonathan,
Thanks for ur reply.I tried by editing run.bat with setting JAVA_OPTS with mentioned parms but i can''t able to debug.Actually i downloaded jboss-ide plugin for eclipse.In the configuration section of jboss-ide i put ''Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug,suspend=y '' for vm arguments.Then i can debug.It asked for source code container.I browsed and put my code in the container.Now can i able to debug step by step.
Once again thanks for ur reply
mahesh

#21
Jörg Spilker commented on 9 Aug 2004

Trying to run Jboss with debugging JVM enabled results in the following error during startup:

JBOSS_HOME: /work/12spilk/JBoss JAVA: /usr/opt/java142/bin/java
JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Dprogram.name run.sh CLASSPATH: /work/12spilk/JBoss/bin/run.jar:/usr/opt/java142/lib/tools.jar

Info: Debugging is not available with the Fast VM, invoking the Classic VM.
Info: Debugging is not available with the Fast VM, invoking the Classic VM.
FATAL ERROR in native method: internal error in JVMDI (phantom frame pop)
at java.util.zip.ZipFile.getEntry(Native Method)
at java.util.zip.ZipFile.getEntry(ZipFile.java:140)
at java.util.jar.JarFile.getEntry(JarFile.java:194)
at java.util.jar.JarFile.getJarEntry(JarFile.java:181)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:668)
at sun.misc.URLClassPath.getResource(URLClassPath.java:156)
at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java, Compiled Code)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:260)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)

....and lots of more errors on the call stack.

The machine is an Alpha Cluster system running True64 Unix 5.1B (Patchkit 4). Java is 1.4.2-2

Is this probably a bug in the VM?

#20
Jonathan Woods commented on 9 Aug 2004

Mahesh -

No need for dedicated plug-ins or anything like that. Just run your JBoss instance as normal, except that instead of letting the Java executable be called as it usually would be, make sure it''s invoked using something like the following command line:

java -Xnoagent -Xdebug -Xrunjdwp:transport=dt_socket,address=8145,server=y,suspend=n

This just lets Java know that it should run in debugging mode, listening out for debuggers attaching on port 8145 using the JPDA standard. I don''t know much about JBoss, so I don''t know where the Java executable would be called from, but it''s probably in a batch file or script somewhere. You''ll have to edit this - but save a copy of the original.

Once you''ve done this, just run JBoss so that it uses the new command line and then follow Bill''s instructions to connect to it from Eclipse. You''ll need to make sure that the port/address settings you''ve used in the above command line (8145 in this case) match what you set in Eclipse.

Good luck with the presentation.

Jon

#19
mahesh adepu commented on 8 Aug 2004

Hi,
I want to debug my running webapplication from eclipse.
I am using JBoss-3.2.4 as my app. server.I know some plugins
like sysdeo,lomboz.sydeo is for tomcat.lomboz only debugs jsp.so how can i debug on jboss-3.2.4.
I will expect a quick reply.As i have to give presentation on web app. debugging infront of my dev. team.
mahesh adepu

#18
rams commented on 2 Jul 2004

In my project, I am using Tomcat and JBOSS. How do I configure both?
Problem facing
1. After configured the tomcat in the eclipse and while clicking run button it is not refering Jboss which is running in my machine.


Feedback Pages:

  • 1
  • 2
  • 3
  • next ›
  • last »


Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers

ADS BY GOOGLE

Breaking Java News
Cabo Drilling Completes $2.0 Million Financing
Exeter Resource Corporation Announces Granting of Stock Options
The Mob Museum Opens Today in Las Vegas
Sikorsky Aircraft Corp. Appoints Airflite to Support Sales in Australia and New Zealand
Hays Salary Guide Released: Salaries in Japan Hold Steady but Skills Shortages Still a Challenge
Dhanoa Minerals Signs L.O.I. to Acquire Mining Claims in California Porphyry Copper Project
Sikorsky Delivers S-92® and S-76® Aircraft to Zhuhai
Accenture Opens New Research & Development Lab in Beijing to Develop Technology Innovations for Clients in China and Asia-Pacific Region
Intergraph(R) PV Elite(R) Pressure Vessel and Exchanger Training Scheduled for March 5-7 in Houston
Summit Partners Opens India Office

ADVERTISE   |   MAGAZINE SUBSCRIPTIONS   |   FREE BREAKING-NEWSLETTERS!   |   SYS-CON.TV   |   BLOG-N-PLAY!   |   WEBCAST   |   EDUCATION   |   RESEARCH

.NET Developer's Journal - .NETDJ   |   ColdFusion Developer's Journal - CFDJ   |   Eclipse Developer's Journal - EDJ   |   Enterprise Open Source Magazine - EOS
Open Web Developer's Journal - OPENWEB   |   iPhone Developer's Journal - iPHONE   |   Virtualization - Virtualization   |   Java Developer's Journal - JDJ   |   Linux.SYS-CON.com
PowerBuilder Developer's Journal - PBDJ   |   SEO / SEM Journal - SJ   |   SOAWorld Magazine - SOAWM   |   IT Solutions Guide - ITSG   |   Symbian Developer's Journal - SDJ
WebLogic Developer's Journal - WLDJ   |   WebSphere Journal - WJ   |   Wireless Business & Technology - WBT   |   XML-Journal - XMLJ   |   Internet Video - iTV
Flex Developer's Journal - Flex   |   AJAXWorld Magazine - AWM   |   Silverlight Developer's Journal - SLDJ   |   PHP.SYS-CON.com   |   Web 2.0 Journal - WEB2
Apache   |   CMS   |   CRM   |   HP   |   Oracle Journal   |   Perl   |   Python   |   Red Hat   |   Ruby on Rails   |   SAP   |   SaaS

SYS-CON MEDIA:   ABOUT US   |   CONTACT US   |   COMPANY NEWS   |   CAREERS   |   SITE MAP
SYS-CON EVENTS:   |  AJAXWorld Conference & Expo  |  iPhone Developer Summit  |  Cloud Computing Conference & Expo  |  SOA World Conference & Expo  |  Virtualization Conference & Expo
INTERNATIONAL SITES:   India  |  U.K.  |  Canada  |  Germany  |  France  |  Australia  |  Italy  |  Spain  |  Netherlands  |  Brazil  |  Belgium
 Terms of Use & Our Privacy Statement     About Newsfeeds / Video Feeds
Copyright ©1994-2008 SYS-CON Publications, Inc. All Rights Reserved. All marks are trademarks of SYS-CON Media.
Reproduction in whole or in part in any form or medium without express written permission of SYS-CON Publications, Inc. is prohibited.
 
close this window