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 187826 - Debugging not synchronized with Deploy on Save
Summary: Debugging not synchronized with Deploy on Save
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: PC Windows Vista
: P1 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 167353 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-19 10:02 UTC by bht
Modified: 2010-10-09 15:25 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2010-06-19 10:02:49 UTC
How to reproduce the bug:

File|New Project|Samples|Servlet Stateless (Java EE6)|Finish

In Projects window, project ServletStateless|Right click|Properties|Run
Change from "GlassFish Server 3" to "GlassFish Server 3 1"|OK

In StatelessSessionBean.java,
Set a breakpoint on this line:

return "Hello, " + name + "!\n";

In Services Window|Servers|GlassFish Server 3 1|Right click|Stop

In Projects window, project ServletStateless|Right click|Debug

The server starts and the home page displays in the browser.

On the home page, enter your name and click the button.

The NetBeans debugger stops on the breakpoint.

Menu|Debug|Continue.

In StatelessSessionBean.java,
insert lines above the breakpoint:

        if(name != null){
            throw new Error();
        }

Save StatelessSessionBean.java

The breakpint jumps to the first line of code.

The application is redeployed automatically.

Set a breakpoint on every line of code.


An error appears in the Debugger console. The console output so far is:

Attaching to localhost:1121
User program running
LineBreakpoint StatelessSessionBean.java : 39 successfully submitted.
Breakpoint hit at line 39 in class servlet.stateless.StatelessSessionBean by thread http-thread-pool-8080-(2).
Thread http-thread-pool-8080-(2) stopped at StatelessSessionBean.java:39.
User program running
Not able to submit breakpoint LineBreakpoint StatelessSessionBean.java : 40, reason: No executable location available at line 38 in class servlet.stateless.StatelessSessionBean.
Invalid LineBreakpoint StatelessSessionBean.java : 40
LineBreakpoint StatelessSessionBean.java : 42 successfully submitted.

In the browser window, repeat data entry as before.

Expected behavior:

The NetBeans debugger stops on the first breakpoint.

Actual behavior:

The NetBeans debugger skips the first breakpoint and stops on the last breakpoint.

End of testcase.

I found this behavior in more complex applications, but under the more generous condition after I stopped and re-started the debugging session to give the server a better chance for reloading.

So far I do not yet have a testcase for the more generous condition.

But I think that this testcase is very relevant because it reflects what developers actually do with the debugger, and I hope that a fix for it will solve many other cases.
Comment 1 Martin Entlicher 2010-06-23 15:40:00 UTC
The debugger does not know that the application was redeployed and therefore it calculates with shifted line numbers as if only the source file was modified.
Comment 2 bht 2010-09-07 21:13:40 UTC
Hi, I am running web applications deployed on GlassFish exclusively in debug mode to increase test coverage for NetBeans.

This bug is one of what appears to me to be a limited number of bugs in the debugger.

It would be nice to get a fix for this, or for bug 187501 with the next point release so that I can get a better handle on other bugs (testcases). Thanks.
Comment 3 bht 2010-09-07 21:43:33 UTC
Sorry, I was referring to bug 189744.
Comment 4 bht 2010-09-16 08:36:45 UTC
This happens also if I manually undeploy, re-build and re-deploy the application. Re-attaching the debugger does not work. So far the only fix I know is to re-start the server. I think this is priority one. The debugger should work without having to re-start the server. Please let's not forget the basics.
Comment 5 Martin Entlicher 2010-09-16 15:30:24 UTC
Well, for me it was enough to restart the debugger. I do not see a reason to restart the server. The debugger just needs to know that the application was redeployed. Task nbjpdaappreloaded was executed in this case in the past to re-submit breakpoints. Calling that task after redeploy should fix this.
Comment 6 Martin Entlicher 2010-09-16 16:07:15 UTC
Calling Deploy manually fixes the breakpoints correctly. It's just a problem of "Deploy on Save" mode.
Comment 7 Martin Entlicher 2010-09-16 16:16:15 UTC
*** Bug 167353 has been marked as a duplicate of this bug. ***
Comment 8 bht 2010-09-16 20:09:19 UTC
Martin I agree with all your statements. Sorry I confused the testcase with my projects where I am not getting away with manual deploy as in the testcase. I don't know why.
Comment 9 David Konecny 2010-10-06 06:11:57 UTC
Martin, are you saying that when Deploy on Save is enabled and app is being debugged that nbjpdaappreloaded task should be called automatically as part of DoS? That make sense.
Comment 10 Martin Entlicher 2010-10-06 11:19:52 UTC
Yes, exactly. I haven't found the place where the nbjpdaappreloaded task should be called from... yet...
Comment 11 Martin Entlicher 2010-10-08 14:33:30 UTC
Fixed in changeset:   179112:b57d191cc590
http://hg.netbeans.org/main/rev/b57d191cc590
Comment 12 bht 2010-10-08 18:42:50 UTC
Thanks very much! This is fantastic.
Comment 13 Quality Engineering 2010-10-09 15:25:48 UTC
Integrated into 'main-golden', will be available in build *201010090000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b57d191cc590
User: mentlicher@netbeans.org
Log: #187826 Correct the breakpoints and lines when program is deployed to the server.