Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Run and Debug a WildFly Swarm App From NetBeans

DZone's Guide to

Run and Debug a WildFly Swarm App From NetBeans

Let's see how you can run and debug your uber or hollow JARs in the form of a WildFly Swarm app from NetBeans with this simple tutorial.

· Java Zone ·
Free Resource

Java-based (JDBC) data connectivity to SaaS, NoSQL, and Big Data. Download Now.

Java EE developers using NetBeans are used to being able to run and debug their thin-WAR applications in their application server of choice directly from NetBeans. When developing microservices packaged as über-or hollow-JARs, you expect the same effortless way of running and debugging. The good news is that you can. In this post, I show step-by-step how to run and debug the WildFly Swarm version of CloudEE Duke in NetBeans.

Run WildFly Swarm Application

The easiest way of running CloudEE Duke in NetBeans is to edit the Run project action for the project. Right click on CloudEE Duke, select properties, then Actions as shown below.

Image title

Configure the Execute Goals to package wildfly-swarm:run, remove all the default properties, and you're all set. Run Project (F6) will start the application using the WildFly Swarm Maven Plugin.

Debug WildFly Swarm Application

To enable debugging, you follow the same steps as described above, but in this case, it is the Debug Project action you select.

Image title

Execute Goals is configured the same way as for Run, but in the Set Properties, you need to configure a debug port for WildFly Swarm. This is done by setting the swarm.debug.port property, e.g. to 9000.

Debug Project (Ctrl-F5) will start the application in debug mode. Note that the execution will halt while waiting for the debugger to attach. See the screenshot below to see how it will look in the log.

Image title

Select Debug->Attach Debugger from the menu in NetBeans. Change the value for Port to 9000 (or the value you chose in the previous step) and click OK.

Image title

To verify the setup, set a breakpoint at line 16 in the class HelloWorldEndpoint.

Image title

Then navigate to http://localhost:8080/hello. The execution will stop at the breakpoint at line 16 inHelloWorldEndpoint.

Image title

Connect any Java based application to your SaaS data.  Over 100+ Java-based data source connectors.

Topics:
java ,java ee ,wildfly swarm ,netbeans ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}