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 227079 - Debugger cannot set valid Breakpoints in Web Project
Summary: Debugger cannot set valid Breakpoints in Web Project
Status: RESOLVED DUPLICATE of bug 225311
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.3
Hardware: PC Windows XP
: P1 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-06 05:53 UTC by bht
Modified: 2013-03-06 15:35 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screen shot of broken breakpoints (68.24 KB, image/gif)
2013-03-06 05:53 UTC, bht
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2013-03-06 05:53:30 UTC
Created attachment 132241 [details]
Screen shot of broken breakpoints

Product Version: NetBeans IDE 7.3 (Build 201302132200)

How to reproduce:

- Start GlasFish in debug mode
- Attach debugger
- Menu|File|New Project|Samples|Java EE|Servlet Stateless (Java EE 6)|Next|Finish
- Projects window|ServletStateless node|Properties|Run|Uncheck "Deploy on Save"|OK
- in StatelessSessionBean, add code above sayHello():
    private static final String string1 = "string1";
    private static final String string2 = "string2";
    private static final String string3 = "string3";
    private static final String string4 = "string4";
- set breakpoint on line 45       return "Hello, " + name + "!\n";
- In my case, this breakpoint is invalid
- Projects window|ServletStateless node|Debug
- In the browser window, enter some text and click "Submit Query"
- Still invalid, debugger does not stop on breakpoint
- Again, Projects window|ServletStateless node|Debug
- This time it works
- In StatelessSessionBean, place the cursor at the end of the class
- Menu|Source|Insert Code|Getter|Check all string1, string2, string3, string4|Generate
- Set breakpoints on the return statements on all 4 new methods
- Each time, error message "Not able to submit breakpoint LineBreakpoint StatelessSessionBean.java ..." appears
- In sayHello(), copy line return "Hello, " + name + "!\n"; below and comment out above
- edit return "Hello, " + name + getString1() + getString2() + getString3() + getString3() + "!\n";
- set a breakpoint on the new line and delete the breakpoint on the line above.
- the breakpoint is valid
- Projects window|ServletStateless node|Debug
- In the browser window, enter some text and click "Submit Query"
- All breakpoints are invalid, the debugger does not stop on a single line
- The breakpoints at some stage jump from the return statements to the method declarations
- If I want to remove such a breakpoint, then I get a method breakpoint which I cannot remove in the source code

I actually wanted to report a bug where the breakpoints are not broken but shown solid, but the debugger ignored them.

So I have bug #1 "Debugger does not stop on Breakpoint" which I don't have a testcase for. Then I report this bug after I discovered bug 227076.

From my perspective, which might be complicated by a strange combination of things, the debugger does not work at all.
Comment 1 Martin Entlicher 2013-03-06 15:35:57 UTC
Your steps are wrong, but as far as I understand it, this is a duplicate of issue #225311.

1) After:
   - set breakpoint on line 45       return "Hello, " + name + "!\n";
   the breakpoint can not be invalid, unless you already have the project
   deployed to the server.
   Explanation: You already have a project with class
   servlet.stateless.StatelessSessionBean deployed on the server and since
   you have debugger attached to the server, NetBeans is trying to submit the
   breakpoint there. But the deployed class differs from the new project
   source code, therefore it does not find an executable code on the given
   location. To notify you about this, NetBeans marks this breakpoint as
   invalid. So that you're not surprised, that the breakpoint does not work.

2) - Projects window|ServletStateless node|Debug
   For me, this ends up with following error:
   connect-debugger:
   /tmp/NetBeansProjects/ServletStateless/nbproject/build-impl.xml:1115: The
   following error occurred while executing this line:
   /tmp/NetBeansProjects/ServletStateless/nbproject/build-impl.xml:1124:
   org.netbeans.api.debugger.jpda.DebuggerStartException: Connection refused
   This is natural, because you can not connect two debuggers to a single
   JVM. One debugger is already attached to the server, you can not start
   and connect a second one.

You probably did Run instead of Debug. Run just compiles and deploys the new code, but debugger knows nothing about this deployment, therefore it tries to submit breakpoint to wrong locations (since the code was modified).

The solution is not to attach the debugger explicitly to the server, but always start it via Projects window|ServletStateless node|Debug or Debug|Debug Project.

*** This bug has been marked as a duplicate of bug 225311 ***