Welcome!

Java IoT Authors: Yeshim Deniz, Heitor Faroni, Jeffrey Abbott, Pat Romanski, PagerDuty Blog

Related Topics: Eclipse, Java IoT, Adobe Flex, Open Source Cloud, IT SOLUTIONS GUIDE, Apache

Eclipse: Article

Debugging Both Flex and Tomcat Java Programs in Eclipse

Having the right debugging tools is crucial for any Web application

If you use Adobe Flex Web applications that connect to Plain Old Java Objects on the server side, chances are that you use a popular, robust, and freely available server called Apache Tomcat.  If you use Eclipse-based Flex Builder, you can smoothly debug both Flex and Java code without leaving Eclipse. Flex Builder debugger does not need any special configuration. But we need to add a couple of parameters to the startup routine of Tomcat so it‘ll engage the Java Platform Debugger Architecture (JPDA), which will allow other applications to attach to the JVM that runs Tomcat and debug deployed Java classes remotely.

You just need to add a couple of options to the JVM that starts Tomcat. In this short article I’ll explain how to do this if you install Tomcat using Windows Service Installer  and run Apache Tomcat as a service under Microsoft Windows. But even if you start Tomcat using command files, JVM parameters remain pretty much the same (see http://tomcat.apache.org/faq/development.html ).

Open the menu Program Files, Apache Tomcat 6.0 and start Apache Monitor Tomcat. In the right corner of the Windows toolbar, you’ll see a small icon with a little red square. Open it up, select the Java tab, and add the following two options lines in the Java Options field:

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

This screen may look as shown below:


 

Press OK – your Tomcat will allow other clients to connect and get debug information through the port 8000. Now go to Eclipse and open the Java perspective that contains the source code of the Java program that is deployed under Tomcat and needs to be debugged.  

The next step is to configure parameters of the remote debug session. Select the Java program and then click on the menu Run | Debug, and then right-click on the option Remote Java Application on the left side of the window shown below. Select New from the menu and fill out the rest of the fields in this Window.
 
Note: The connection properties of the Eclipse debug session should be configured to connect to the same port 8000, where Tomcat is publishing its debug information.


 

Close the debug configuration window, highlight the name of your Java class, and press the button Debug, and it’ll start the debug session on this port. You can also start this debug session by right-clicking on your Java program name and pressing the button Debug.

The rest is simple – set a breakpoint in your Java program, and when this code will be executed, Eclipse brings the Java debugger and stops there. If you hit a breakpoint set in your ActionScript code, the Flex Builder debugger will pop up.

Note: If you see an error message, the chances are that you are trying to start the debug session on port 8000 more than once, which is not allowed.

This is not the only way to debug your Java code deployed under the J2EE application server. For more debug options, see Chapter 12 of the book Rich Internet Applications with Adobe Flex and Java.

Happy coding and debugging with Flex and Java!

More Stories By Yakov Fain

Yakov Fain is a Java Champion and a co-founder of the IT consultancy Farata Systems and the product company SuranceBay. He wrote a thousand blogs (http://yakovfain.com) and several books about software development. Yakov authored and co-authored such books as "Angular 2 Development with TypeScript", "Java 24-Hour Trainer", and "Enterprise Web Development". His Twitter tag is @yfain

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Dario Laverde 11/12/07 03:30:22 PM EST

Hello Yakov,

Just want to point out that one doesn't have to always use JPDA when debugging Tomcat in Eclipse (or any IDE for that matter). You can define a run/debug configuration with org.apache.catalina.startup.Bootstrap as your main class running from Tomcat's home directory.

You can additionally avoid redeploying web apps (and restarting the debug session) by defining the docBase in the deployed context file to point to your application's workspace folder so as you edit files Tomcat automatically redeploys with each save.

regards,

Dario

@ThingsExpo Stories
SYS-CON Events announced today that Outlyer, a monitoring service for DevOps and operations teams, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Outlyer is a monitoring service for DevOps and Operations teams running Cloud, SaaS, Microservices and IoT deployments. Designed for today's dynamic environments that need beyond cloud-scale monitoring, we make monitoring effortless so you ...
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
Why do your mobile transformations need to happen today? Mobile is the strategy that enterprise transformation centers on to drive customer engagement. In his general session at @ThingsExpo, Roger Woods, Director, Mobile Product & Strategy – Adobe Marketing Cloud, covered key IoT and mobile trends that are forcing mobile transformation, key components of a solid mobile strategy and explored how brands are effectively driving mobile change throughout the enterprise.
SYS-CON Events announced today that Technologic Systems Inc., an embedded systems solutions company, will exhibit at SYS-CON's @ThingsExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Technologic Systems is an embedded systems company with headquarters in Fountain Hills, Arizona. They have been in business for 32 years, helping more than 8,000 OEM customers and building over a hundred COTS products that have never been discontinued. Technologic Systems’ pr...
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Artificial Intelligence has become a topic of intense interest throughout the cloud developer and enterprise IT communities. Accordingly, attendees at the upcoming Cloud Expo | @ThingsExpo at the Javits Center in New York, June 6-8, will find fresh new content in a new track called Cognitive Computing | Artificial Intelligence, Machine Learning, Deep Learning. Cloud Expo is still accepting submissions for this new track, so please visit www.cloudcomputingexpo.com for the latest information. 2...
SYS-CON Events announced today that Tintri, Inc, a leading provider of enterprise cloud infrastructure, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Tintri offers an enterprise cloud platform built with public cloud-like web services and RESTful APIs. Organizations use Tintri all-flash storage with scale-out and automation as a foundation for their own clouds – to build agile development environments...
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
In his General Session at 17th Cloud Expo, Bruce Swann, Senior Product Marketing Manager for Adobe Campaign, explored the key ingredients of cross-channel marketing in a digital world. Learn how the Adobe Marketing Cloud can help marketers embrace opportunities for personalized, relevant and real-time customer engagement across offline (direct mail, point of sale, call center) and digital (email, website, SMS, mobile apps, social networks, connected objects).
More and more brands have jumped on the IoT bandwagon. We have an excess of wearables – activity trackers, smartwatches, smart glasses and sneakers, and more that track seemingly endless datapoints. However, most consumers have no idea what “IoT” means. Creating more wearables that track data shouldn't be the aim of brands; delivering meaningful, tangible relevance to their users should be. We're in a period in which the IoT pendulum is still swinging. Initially, it swung toward "smart for smart...
Buzzword alert: Microservices and IoT at a DevOps conference? What could possibly go wrong? In this Power Panel at DevOps Summit, moderated by Jason Bloomberg, the leading expert on architecting agility for the enterprise and president of Intellyx, panelists peeled away the buzz and discuss the important architectural principles behind implementing IoT solutions for the enterprise. As remote IoT devices and sensors become increasingly intelligent, they become part of our distributed cloud enviro...
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
SYS-CON Events announced today that Hitrons Solutions will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Hitrons Solutions Inc. is distributor in the North American market for unique products and services of small and medium-size businesses, including cloud services and solutions, SEO marketing platforms, and mobile applications.
SYS-CON Events announced today that TMC has been named “Media Sponsor” of SYS-CON's 20th International Cloud Expo and Big Data at Cloud Expo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY, , and the 21st International Cloud Expo, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Global buyers rely on TMC’s content-driven marketplaces to make purchase decisions and navigate markets. Learn how we can he...
"I think that everyone recognizes that for IoT to really realize its full potential and value that it is about creating ecosystems and marketplaces and that no single vendor is able to support what is required," explained Esmeralda Swartz, VP, Marketing Enterprise and Cloud at Ericsson, in this SYS-CON.tv interview at @ThingsExpo, held June 7-9, 2016, at the Javits Center in New York City, NY.
In his session at @ThingsExpo, Steve Wilkes, CTO and founder of Striim, will delve into four enterprise-scale, business-critical case studies where streaming analytics serves as the key to enabling real-time data integration and right-time insights in hybrid cloud, IoT, and fog computing environments. As part of this discussion, he will also present a demo based on its partnership with Fujitsu, highlighting their technologies in a healthcare IoT use-case. The demo showcases the tracking of patie...
SYS-CON Events announced today that SD Times | BZ Media has been named “Media Sponsor” of SYS-CON's 20th International Cloud Expo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY. BZ Media LLC is a high-tech media company that produces technical conferences and expositions, and publishes a magazine, newsletters and websites in the software development, SharePoint, mobile development and commercial UAV markets.
SYS-CON Events announced today that Linux Academy, the foremost online Linux and cloud training platform and community, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Linux Academy was founded on the belief that providing high-quality, in-depth training should be available at an affordable price. Industry leaders in quality training, provided services, and student certification passes, its goal is to c...
SYS-CON Events announced today that delaPlex will exhibit at SYS-CON's @CloudExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. delaPlex pioneered Software Development as a Service (SDaaS), which provides scalable resources to build, test, and deploy software. It’s a fast and more reliable way to develop a new product or expand your in-house team.
SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex softw...