This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 133189 - Breakpoints not working with J2EE Enterprise application with JSF
Summary: Breakpoints not working with J2EE Enterprise application with JSF
Status: VERIFIED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 2 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 134547 136832 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-18 11:31 UTC by rickhoro
Modified: 2008-07-08 16:06 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Contains the Enterprise project, the table, a text file of where the breakpoints are and the 3 log outputs including the breakpoint submissions (92.16 KB, text/plain)
2008-05-15 11:35 UTC, tomsimmons
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rickhoro 2008-04-18 11:31:02 UTC
My setup includes current Linux Mint with JDK 1.6 and NB6.1rc1. 

I'm able to produce this problem as follows. I created an Enterprise application called "TestJ2EE" and then added
JavaServer Faces framework to the TestJ2EE-war subproject. I then added a JSF managed bean called "TestBean" (using the
JSF managed bean wizard). Inside this bean, I created an action method:

    public String processButton() {
        Logger.getLogger(TestBean.class.getName()).info("Made it to TestBean.processButton()");
        return null;
    }

I then added an h:form and h:commandButton to the welcomeJSF.jsp page that was created by NetBeans when I added the JSF
framework. The body of welcomeJSF.jsp looks like this:

    <body>
        <f:view>
            <h1><h:outputText value="JavaServer Faces" /></h1>
            <h:form>
                <h:commandButton value="Press Me" action="#{TestBean.processButton}"/>
            </h:form>
        </f:view>
    </body>

With this setup, I am getting very flaky breakpoint/debugger behavior. In order of what I have experienced:

1. I first deployed the application by selecting "Debug" from the TestJ2EE project's context menu, to deploy it to a
running instance of Glassfish (which had previously been started in debug mode and which had another J2EE Enterprise
application deployed at the time). When I then tried to set a breakpoint on either or both of the lines in the
processButton() action method, I got the following in the Debugger Console:

Not able to submit breakpoint LineBreakpoint TestBean.java : 21, reason: The breakpoint is set outside of any class.
Invalid LineBreakpoint TestBean.java : 21

Just to make sure the application was working, I clicked the "Press Me" button and verified that the log message "Made
it to TestBean.processButton()" was written to the log.

I then tried various ways to re-deploy the app: I tried Undeploy/Redeploy from the context menu, tried "Debug" again,
tried undeploying the application by selecting it from the Glassfish server node and selecting undeploy. None of these
actions made any difference.

I then undeployed both applications from the Glassfish instance by selecting "Undeploy" from the Glassfish Enterprise
Applications context menu. I then shutdown Glassfish and restarted it in debug mode. I then deployed the test
application again by selecting Debug from its context menu. This time when I tried to set a breakpoint on either of the
two code lines in the processButton() method, the breakpoints showed up in the editor margin. However, when I clicked
the "Press Me" button, the breakpoints were ignored. I then set a method breakpoint. When I clicked the "Press Me"
button, execution stopped, at the "Logger.getLogger(TestBean.class.getName()).info("Made it to
TestBean.processButton()");" line inside the method.

Please see below the full TestBean.java JSF managed bean file, the welcomeJSF.jsp file, and the web.xml and
faces-config.xml config files.

TestBean.java:

import java.util.logging.Logger;
public class TestBean {
    public TestBean() {
    }
   
    public String processButton() {
        Logger.getLogger(TestBean.class.getName()).info("Made it to TestBean.processButton()");
        return null;
    }
}

welcomeJSF.jsp:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <f:view>
            <h1><h:outputText value="JavaServer Faces" /></h1>
            <h:form>
                <h:commandButton value="Press Me" action="#{TestBean.processButton}"/>
            </h:form>
        </f:view>
    </body>
</html>

faces-config.xml:

<?xml version='1.0' encoding='UTF-8'?>

<!-- =========== FULL CONFIGURATION FILE ================================== -->

<faces-config version="1.2"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
    <managed-bean>
        <managed-bean-name>TestBean</managed-bean-name>
        <managed-bean-class>TestBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
</faces-config>

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>
Comment 1 Dan Kolar 2008-04-18 16:08:01 UTC
I tried your scenario in NB 6.1 RC2 and:
1) I'm able to submit breakpoint anywhere, both bean and jsp, w/o any problem.
2) Breakpoints in jsp works, but in bean they don't. 
Comment 2 Dan Kolar 2008-04-18 16:41:54 UTC
After further examination, it seems its related to glassfish status, when it's in debug mode, sometimes breakpoint can't
be set, but when it's stopped, or restared all is ok.
About ignoring breakpoint, it seems there's some problem, because for Visual JSF Button debugging works fine.
Comment 3 Martin Entlicher 2008-04-30 16:27:27 UTC
I've reproduced the problem. It looks like debugger does not detect that the class was loaded and therefore does not try
to submit the breakpoint. It needs further investigation to find out what's going on...
Comment 4 Daniel Prusa 2008-05-12 12:57:29 UTC
*** Issue 134458 has been marked as a duplicate of this issue. ***
Comment 5 tomsimmons 2008-05-15 10:25:47 UTC
Did a bit more testing on this last night, using my project.....

breakpoint in JSP is fine
breakpoint in Facade is fine
breakpoint in a utility class is fine
breakpoint in Backing Bean ignored

The breakpoint I added in the Facade was in a method called by another in the same facade, and the parent method was 
the one being called from the Backing Bean line that I added the breakpoint to.  When it's stopped at the Facade 
breakpoint, if I change back to the Backing Bean code, the line is marked with the gray triangle showing the origin.

The project is an Enterprise app consisting of the 3 projects, the EJB project, and the WEB project, and the umbrella 
project (Backing beans and JSP in the WEB, Facade and utility class in the EJB).

I did try looking at the sample projects, but I couldn't find a project of this structure.  I tried the JSFJPA project 
with a breakpoint in UserManager.createUser, that works.
Comment 6 tomsimmons 2008-05-15 11:35:49 UTC
Created attachment 61429 [details]
Contains the Enterprise project, the table, a text file of where the breakpoints are and the 3 log outputs including the breakpoint submissions
Comment 7 tomsimmons 2008-05-15 21:13:56 UTC
Another update!!!

If you add a field breakpoint to your Backing Bean then use CTRL + F5 to start, the breakpoints are registered and 
execution stops in the Backing Bean.

Also, if you start with CTRL + F5, then stop the deubgger, SHIFT + F5, then re-attach the debugger (Run menu) then 
line breakpoints work in your Backing Bean.
Comment 8 Dan Kolar 2008-05-19 12:11:07 UTC
This bug seems to be fixed  by fix of issue 134276 now.
Closing as fixed.
Comment 9 Petr Blaha 2008-05-19 12:15:36 UTC
Reporter, can you please try to verify the fix in the latest NB daily build? You can download the bits here
http://bits.netbeans.org/dev/nightly/latest/ Thanks for your help.
Comment 10 Dan Kolar 2008-05-19 12:30:40 UTC
v. in build 20080514055548
Comment 11 Martin Entlicher 2008-06-11 22:34:00 UTC
*** Issue 134547 has been marked as a duplicate of this issue. ***
Comment 12 Martin Entlicher 2008-06-11 22:35:56 UTC
*** Issue 136832 has been marked as a duplicate of this issue. ***