Debugging GateIn

Version 1

    GateIn can be debugged as any other application deployed on JBoss AS:

     

    1. As a Remote JVM, started manually and by attaching a debugger to the JVM
    2. As a local JVM, managed by your IDE

     

    Option 1: remote debugger

     

    For this option, you'd have GateIn running already in an external JVM. "External" here is "foreign to the IDE" (as the IDE would be running on a JVM itself). Here' how you can configure it for IntelliJ

     

    • Clone the gatein-portal repository
    • Build it by following the README instructions
    • Import the main pom.xml file into IntelliJ. Do not make a recursive import, as you might end up importing samples and other projects, which might not be relevant for the day-to-day activities
    • On IntelliJ, go to "Run" -> "Edit configurations" (Alt+u - r)
    • Click on the green "+" on the top left corner of the Window and select "JBoss Server" -> "Remote"
    • As you might not have a server configured yet, you'll need to click on "Configure" and add a new JBoss AS server. Just select the GateIn distribution that you've downloaded. Alternatively, you can select the GateIn you've built previously, located at gatein-portal/packaging/jboss-as7/pkg/target/jboss/
    • Go to the "Startup/Connection" tab, select "Debug" and use the properties shown there as JAVA_OPTS for starting the server manually.

     

    To debug, just start your GateIn instance and click on the Debug icon (Alt+Shift+F9). The remote debugger should attach to the JVM that is running your GateIn instance

     

    Option 2: local debugger

     

    This option is optimal for the most cases, where you'd make a change in some module, compile it, package a new AS and debug the change. "Local" here is local to the JVM that your IDE is running, meaning that your IDE controls the lifecycle of the JVM running GateIn.

    • Clone the gatein-portal repository
    • Build it by following the README instructions
    • Import the main pom.xml file into IntelliJ. Do not make a recursive import, as you might end up importing samples and other projects, which might not be relevant for the day-to-day activities
    • On IntelliJ, go to "Run" -> "Edit configurations" (Alt+u - r)
    • Click on the green "+" on the top left corner of the Window and select "JBoss Server" -> "Remote"
    • As you might not have a server configured yet, you'll need to click on "Configure" and add a new JBoss AS server. Just select the GateIn you've built previously, located at gatein-portal/packaging/jboss-as7/pkg/target/jboss/
    • IntelliJ will complain that there are no artifacts being deployed. You can select "gatein-simplest-helloworld:war" artifact.

     

    To debug, just select the configuration you've just created and hit the "Debug" icon (Alt+Shift+F9). IntelliJ should then start your GateIn instance already in Debug mode.

    Note that if you made any changes to the code, you'll need to rebuild your distribution. A simple solution is to run "mvn clean install" on the module that you've changed and "mvn clean package -Dservers.dir=$SERVERS_DIR" in the "packaging/jboss-as7/pkg" module. It should take less than 20 seconds to build a new GateIn JBoss AS bundle on a modern machine.