Skip to main content

how to debug JSF 2.x in Glassfish 3.1?

2 replies [Last post]
wasedaxiao
Offline
Joined: 2003-06-13
Points: 0

I want to trace the flow of JSF RI that handles the request and response. I started GF 3.1 like below.

$ asadmin.bat start-domain --debug true

I attached Netbeans' debugger and set a breakpoint at javax.faces.webapp.FacesServlet#service. But after sending a request from faceslet application, the breakpoint was not hit.

How to debug JSF in Glassfish 3.1?

Thank you in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
oversteer
Offline
Joined: 2011-03-28
Points: 0

It's a lot easier if you're using a maven project. As a NetBeans user, I just right click the server instance and start in
debug mode, then hit the Debug Main Project icon at the top of the screen. Then in my dependencies list in the
Projects tab, I open jsf-api-2.1.3.jar, then javax.faces.component.html, then double click HtmlOutputText.class, the
java file is opened. Then set a method breakpoint on for example on setDir(), then add a tag h:outputText dir="RTL"
somewhere and off you go...
Without maven (again in NetBeans) I right click on the project in the Projects tab, select Sources and in Source
Package Folders select Add Folder. Assuming I've unzipped the sources to a directory mojarra-2.1.3-FCS-source,
add the folder mojarra-2.1.3-FCS-source\jsf-api\src\main. Do the same for jsf-ri. This non-maven stuff I'm typing
from memory, so caveat emptor.
If you're using Eclipse, I'd hope it's not all that different.

lamostreta
Offline
Joined: 2011-09-06
Points: 0

I don't know about debuging from Glassfish but there is a blog post about debuging JSF lifecyle using poor man's debugging approach using sysouts:

http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html