Run and Debug a WildFly Swarm App From NetBeans
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.
Join the DZone community and get the full member experience.
Join For FreeDownload Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.
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.
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.
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.
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.
To verify the setup, set a breakpoint at line 16 in the class HelloWorldEndpoint.
Then navigate to http://localhost:8080/hello. The execution will stop at the breakpoint at line 16 inHelloWorldEndpoint.
Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat.
Published at DZone with permission of Ivar Grimstad , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}
{{ parent.urlSource.name }}