How to debug JBoss container source code

I would like to be able to set breakpoints on source code inside the container of a local instance of JBoss and follow what happens in the container when my JEE application invokes HttpServletRequest#logout().

1.  I downloaded the correct version of JBoss source code and extracted it onto my local file system.  Next, I added the source code to the JBoss Application Servers configuration e.g. File -> Settings -> Application Servers and then clicked on the Plus button in Libraries and added the source code.  But this did not work. I could set a breakpoint but the code execution did not stop at the breakpoint.  The file I opened to set the breakpoint had a yellow tab unlike the normal-colored tabs of my application's source code files.  What does it mean when you open a .java file and the tab is yellow?

Moreover, some of the imports of the .java file cannot be found, such as the following:

import org.apache.catalina.Realm;
import org.apache.catalina.realm.GenericPrincipal;

I presume the JAR files for these imports exist inside my JBoss installation, which I'm already using successfully to run and debug my application's source code.  I'm reluctant to add Catalina JARs to the intelliJ Application Server Library because I don't want to mess up my JBoss configuration.

2.  My next step was to add the JBoss source code to the Global Library e.g. File -> Project Structure -> Platform Settings -> Global Libraries, then click on the Plus button and select New Global LIbrary ->Java, and finally click on the Plus button and select "Attach Files or Directories" and add the JBoss source code there.  I was happy to see that intelliJ processed the source files, indexing them.  I was sure that now the breakpoint would work.  It did not work.  I restarted intelliJ and tried again.  The breakpoint still did not work and the JBoss .java file continues to have a yellow tab.

What am I doing wrong?



To be able to debug HttpServletRequest#logout() you may follow the steps below:

1) place breakpoint on the call to HttpServletRequest#logout() in your source code, launch JBoss and make breakpoint hit

2) when on breakpoint, press Step Into -- this action does not require JBoss sources to be attached, as the result, you'll step into #logout.
of course, you will not see the source of #logout, but will see which class contains #logout;
HttpServletRequest is an interface, and in case of JBoss 7 you should see org.apache.catalina.connector.RequestFacade which implements the


See attached screenshot step-into-no-src.png - this is what expected after stepping into HttpServletRequest#getContextPath(), so you may
see the same situation.

3) org.apache.catalina.connector.RequestFacade is not included into sources available on the page under
'Source Code' menu, since it is included into JBoss Web component ( page), so you should download sources

4) once downloaded, you should either create a new library (global or module level) or just modify existing JBoss application server library
in IDEA. The library should contain the jar from JBoss installation containing compiled RequestFacade (<JBoss
home>/modules/org/jboss/as/web/main/jbossweb-7.0.13.Final.jar in case of JBoss 7.1.1).

And, of course, the library should contain downloaded JBoss Web sources directory.

See attached sreenshot app-server-lib.png -- this is how JBoss application server library will look like after
jbossweb-7.0.13.Final.jar and JBoss Web sources directory are added to it (c:\j\as\jboss-as-7.1.1.Final is the JBoss home, and
c:\j\idea\120314-jbossweb-700-source is the directory where sources from were
downloaded to)

5) the library should be added to the dependencies of the module you have placed the breakpoint to. See attached module-dependencies.png --
this is how module dependencies will look like after JBoss application server library is added.

6) finally, you should hit the breakpoint again, now on Step Into you'll be navigated to the RequestFacade source code -- see attached



Unfortunately it didn't work for me. In my case want to debug throuhg tomcat container source-code. I attached source code and stepping into didn't work (also pointing to call-entry in Frame-View inside Debugger doesn't jump to it).

Maybe this is a bug (am using 11.1.1.)?



I chose different style, I hacked a new library in Module-Settings (tomcat lib + source-code) and added them to all my modules. But still it should work to add source-code in container-configuration.


Please sign in to leave a comment.