A JBoss Project
Red Hat

Latest posts

Debugging externally-launched Java applications has always been possible in Eclipse via the Remote Java Application launch configuration type, so long as you manually add the host and debug port to the launch configuration. A few years ago, you may have seen an enhancement we here at JBoss Tools provided, making it easier to connect your sourcecode in Eclipse to an externally-launched process.

Well, history tends to repeat itself, and more enhancements are in the pipeline that make this even easier. We expect the enhancements in this blog to be present in JBoss Tools 4.3.0.Alpha2, so be prepared ;) You can track the progress at JBIDE-19397, or try it out by installing our nightly build.

While the changes you’ll read here today apply to all running java applications, I’ll be focussing on debugging an externally launched WildFly for this article.

The JMX Navigator

JBoss Tools has shipped a JMX Navigator for several years. Changes in the past year have brought with it an enhancement to the JMX Navigator in our most recent release. An extension to the JMX Navigator can now also auto-detect locally running processes, and allow a user to browse their JMX tree.

Not only can we can automatically detect all running java processes, we can also see which ones have been run with the proper debug flags such that a remote debugger can connect to it.

How can this be used with WildFly?

WildFly has the ability to be launched with the --debug flag. This will expose the port 8787 for a debugger to connect to. But if you didn’t know the port, and your startup was taking longer than you’d like, or it was scrolling too fast for your liking, and your google is broken, you could simply right-click the new process in the JMX Navigator and select Connect Debugger. This is an incremental improvement over our past work, because it’s been trimmed down from a right-click action on a project, followed by a dialog, to just the right-click action on the process directly.

This sounds too easy…​ show me

Alright, I’ll show you.

Set up your environment

First, in JBoss Tools, go ahead and make yourself a new server adapter for WildFly. You can use any of the configuration options you want, really. It shouldn’t make a difference at all.

The only thing you must do, though, is when creating your server adapter, make sure you check Server lifecycle is externally managed.

20150312 new server external

Once this is done, we can make a simple Dynamic Web Project with a Servlet. To do this, select File → New → Dynamic Web Project and follow the wizard’s instructions. After that, right-click your project, and select File → New → Servlet. A stub file will be generated for you, but we’d like to have it respond something, so let’s go ahead and change the doGet method as follows:

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String ret = "Hello World: " + System.currentTimeMillis();
		response.getOutputStream().write(ret.getBytes());
	}

Let’s also go ahead and set a breakpoint here, just so we can see when it gets hit later on.

Start the Server via Command Line

In a terminal, you can browse to your WildFly installation and simply run the following:

./standalone.sh --debug

Deploy the project

In your project, browse to your servlet’s java file and select it in the Package Explorer, Project Explorer, Navigator, or whichever other view you prefer. Right-click on it, and select Run as → Run on Server…​ to deploy it.

This action will attempt to start your server, so if you didn’t make sure to check the Server lifecycle is externally managed checkbox during creation, you may run into problems. If you did, though, your server adapter is configured to take no action during 'start'.

In the terminal, you should see some output indicating the module was published.

06:12:01,896 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015876: Starting deployment of "DWS.war" (runtime-name: "DWS.war")
06:12:01,947 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017534: Registered web context: /DWS
06:12:02,009 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018565: Replaced deployment "DWS.war" with deployment "DWS.war"

You should also notice that the internal web browser has opened up to your servlet in JBoss Tools, and shows some content…​ but your breakpoint wasn’t hit. Your remote debugger hasn’t been connected.

So connect the debugger!

If it’s not already open, go ahead and open your JMX Navigator view. You should see a few entries already under Local Processes, since Eclipse is running, and so is WildFly.

20150312 connect debugger

You can just go ahead and click Connect Debugger. Now, if you switch to the browser that was opened previously and refresh the page, your breakpoint should be hit, and it should browse to your servlet’s code.

To detach the debugger, you can right-click the same entry again and simply click "Disconnect Debugger".

Can’t you already launch a server with a debugger attached?

Yes, you can. But not all developers will want the debugger connected at all times. They may have custom startup scripts, or personal preferences such that they prefer to always launch via command line, but still wish for convenient access to the debugger. When a server is launched in debug mode from inside eclipse, you cannot disconnect the debugger without also stopping the server. This enhancement allows you to keep the two actions separate, which, we hope, makes our tools more useful for a wider range of individuals.

Conclusion

While small enhancements like this might seem small or incremental, they add up to lots of changes that make your development experience faster, smoother, and more flexible for a wider range of developers and all their divergent personal preferences. We hope you like it.

Rob Stryker

We’re there! - JBoss Data Virtualization tooling is now available. JBoss Tools Integration Stack 4.2.0.Final / JBoss Developer Studio Integration Stack 8.0.0.GA

jbosstools jbdevstudio blog header

The Integration Stack for JBoss Tools Developer Studio is a set of plugins for Eclipse that provides tooling for the following frameworks.

JBoss Business Process and Rules Development

  • BPEL Designer - Orchestrating your business processes.

  • BPMN2 Modeler - A graphical modeling tool which allows creation and editing of Business Process Modeling Notation diagrams using graphiti.

  • Drools - A Business Logic integration Platform which provides a unified and integrated platform for Rules, Workflow and Event Processing.

  • jBPM - A flexible Business Process Management (BPM) suite.

JBoss Data Virtualization Development

  • Modeshape - A distributed, hierarchical, transactional and consistent data store with support for queries, full-text search, events, versioning, references, and flexible and dynamic schemas. It is very fast, highly available, extremely scalable, and it is 100% open source.

  • Teiid Designer - A visual tool that enables rapid, model-driven definition, integration, management and testing of data services without programming using the Teiid runtime framework.

JBoss Integration and SOA Development

  • All of the Business Process and Rules Development plugins, plus…​

  • Fuse Apache Camel Tooling - A graphical tool for integrating software components that works with Apache ServiceMix, Apache ActiveMQ, Apache Camel and the FuseSource distributions.

  • SwitchYard - A lightweight service delivery framework providing full lifecycle support for developing, deploying, and managing service-oriented applications.

SOA 5.x Development

  • JBoss ESB - An enterprise service bus for connecting enterprise applications and services.

  • jBPM3 - A flexible Business Process Management (BPM) Suite - JBoss Enterprise SOA Platform 5.3.x compatible version.

All of these components have been verified to work with the same dependencies as JBoss Tools 4.2 and Developer Studio 8.

Installation

To install the Integration Stack tools, first install JBoss Developer Studio from the all-in-one installer, bundled and configured out of the box with everything you need to get started. Alternatively, if you already have eclipse-jee-luna installed, you can install JBoss Developer Studio or JBoss Tools from the Eclipse Marketplace via Help > Eclipse Marketplace…​

Eclipse Marketplace - JBDS

Once Developer Studio is installed, restart Eclipse and select the Software/Update tab in the JBoss Central view. The current 8.0.0.GA integration stack is available automatically with the released JBoss Data Virtualization Development tooling. The remainder of the integration tooling is available as Early Access so you must check the Enable Early Access checkbox in the installer window in order to install.

Select the items you’d like to install:

JBoss Central Early Access - JBoss Developer Studio Integration Stack

The standard p2 installer is available for JBoss Developer Studio Integration Stack. Simply start jbdevstudio or eclipse-with-jbds, then:

 Help > Install New Software...
 Add...
 - use this for 'Location:' for the production integration stack:
   http://www.qa.jboss.com/binaries/RHDS/updates/stable/luna/integration-stack/aggregate/8.0.0.GA/

 - use this for 'Location:' for the early access integration stack:
   http://www.qa.jboss.com/binaries/RHDS/updates/stable/luna/integration-stack/aggregate/8.0.0.GA/earlyaccess/

The community JBoss Tools Integration Stack installation is easy as well. If you already have eclipse-jee-luna installed, install JBoss Tools from the Eclipse Marketplace via Help > Eclipse Marketplace…​

Eclipse Marketplace - JBoss Tools

Once JBoss Tools is installed, restart Eclipse and select the Software/Update tab in the JBoss Central view. The current 4.2.0.Final integration stack is available automatically with the released 'JBoss Data Virtualization Development' tooling. In a manner similar to devstudio, the remainder of the integration tooling is available as "Early Access" so you must check the "Enable Early Access" checkbox in the installer window in order to install.

Select the items you’d like to install:

JBoss Central Early Access - JBoss Tools Integration Stack

The standard p2 installer is available for JBoss Tools Integration Stack. Simply start eclipse-with-jbt, then:

 Help > Install New Software...
 Add...
 - use this for 'Location:' for the released-components integration stack:
   http://download.jboss.org/jbosstools/updates/stable/luna/integration-stack/

 - use this for 'Location:' for the early access integration stack:
   http://download.jboss.org/jbosstools/updates/stable/luna/integration-stack/earlyaccess

Note: If you installed into your own Eclipse you should bump up the launch resource parameters:

--launcher.XXMaxPermSize 256m --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms512m -Xmx1024m

What’s Been Updated?

The JBoss Data Virtualization tooling (ModeShape, Teiid Designer) is released. New features and bug fixes in the early access tooling are available as well.

Released Tooling Highlights

Teiid Designer Highlights

Teiid Designer 8.4 introduces the following changes and features
  • Added option to auto-create VDB data source after deployment

  • Improved model name validation in wizards and dialogs

  • Expanded SQL Template insert/replace functionality

  • Added ability to define virtual table as global temporary table

  • Improved Guides View functionality

  • Lock Diagrams feature

  • Teiid Connection Importer allows saving DDL to workspace

  • for details: Teiid Designer 8.4

Teiid Designer 8.5 introduces the following changes and features
  • Replaced teiid client plugins with a single runtime plugin

  • Support for dynamic extension metadata

  • VDB Editor layout improvements

  • Added ability to view a built-in MED

  • Improved Default Server naming

  • Enhance security for Data Roles UI

  • Add ability to create User Function in Transformation Editor

  • for details: Teiid Designer 8.5

Teiid Designer 8.6 introduces the following changes and features
  • Support for a Native Query Procedure

  • REST Importer Enhancements

  • Added Dynamic Parameter Capability to REST Importer

  • Added Dynamic Parameters to Generated REST Procedure

  • Added JSON REST Web Service Support

  • Improved Security Definition for Data Roles

  • for details: Teiid Designer 8.6

Teiid Designer 9.0 introduces the following changes and features
  • Show Rest WS Response Document on Import

  • Quick Fix for migrating Designer 7.7 REST model extension properties

  • Added additional support for comments in transformation SQL

  • for details: Teiid Designer 9.0

Early Access Highlights

For more specifics see:

BPMN2 Modeler

  • The Graphiti framework dependency was changed to require only 0.11. This is now aligned with the same version that is shipped with Eclipse Luna.

  • BPMN 2.0 Model validation has been reworked to allow extension plug-ins to override specific model element constraints. See Bug 427470 for details.

  • Double-click handling in the Outline and Problems views has been improved: a double-click on a node in the Outline view, or an error item in the Problems view will now display the Property sheet for the associated model object to allow immediate editing of the object.

  • The editor now performs a Live validation just before saving a file, and cancels the save process if the model is found to be corrupt (invalid ID string, duplicate IDs, etc.) This prevents the model file from being corrupted.

  • A new User Preference has been added to the Editor Behavior preference page, which allows Text fields to be limited to a maximum length. The default is 255 characters. Note that Multiline text boxes, such as those used for Documentation and Scripts, are not subject to this limit.

  • for details: https://www.eclipse.org/bpmn2-modeler/whatsnew/whatsnew-1.1.2.php

Fuse Tooling

See Lars Heinemann’s Blog for more insights.

The JBoss Tools website features tab

Don’t miss the Features tab for up to date information on your favorite Integration Stack components.

Give it a try!

Paul Leacu.

Looking for older posts ? See the Archived entries.
back to top