Over a million developers have joined DZone.

Debugging Using Wildfly and Arquillian

· Java Zone

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

This should be most useful for those starting out with Arquillian! I spent quite some time before finding out the solution.

The arquillian.xmlshould include the following contents:

     <property name="deploymentExportPath">target/</property>  
   <container qualifier="jbossas-managed-wildfly-8" default="true">  
        <protocol type="jmx-as7">  
       <property name="executionType">REMOTE</property>  
          <property name="allowConnectingToRunningServer">true</property>  
       <property name="jbossHome">C:\Program Files (x86)\PSL\RCA\ApplicationServer</property>  
       <property name="modulePath">C:\Program Files (x86)\PSL\RCA\ApplicationServer\modules</property>  
       <property name="javaVmArguments">-Xrunjdwp=transport=dt_socket,address=8000,server=y,suspend=n -Djava.util.logging.manager=org.jboss.logmanager.LogManager</property>  

Include the following profile in your Maven pom.xml:

      <!-- Required by jboss-javaee-6.0:3.0.2.Final (https://issues.jboss.org/browse/JBBUILD-708) -->  

When we use Arquillian, there are three VM's that are involved:

1. Arquillian (Source) > Remote/Managed Server

Start the Remote/Managed Server with the following line added to standalone.conf.bat

 set "JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"  

In Eclipse, Right Click on your project and Click on "Debug" and under "Connect" - Select your "Host" and "Port". Click on "Apply" and "Debug". This will connect the Debugger to the Remote VM inside Wildfly. 

2. Test > Remote/Managed Server

Now, Right Click on your Arquillian Test and Click on "Debug As.." or "Debug Configurations". Then select either "TestNG" or "JUnit".


Now, you will be able to hit the breakpoint. Happy Debugging!

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.


Published at DZone with permission of Sumith Puri, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}