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 51880

Summary: JPS debugging is not working properly in free form project when attach is used
Product: javaee Reporter: L Martinek <lmartinek>
Component: Web FreeformAssignee: Milan Kubec <mkubec>
Status: VERIFIED FIXED    
Severity: blocker CC: abadea, geertjan, jskrivanek, lkotouc
Priority: P3 Keywords: RELNOTE
Version: 4.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 57025    
Bug Blocks:    

Description L Martinek 2004-11-27 17:13:54 UTC
[RC1, JDK 1.5.0_01]

Green line is missing when breakpoint is reached
and 'Step Over' behaves like 'Continue'. Sometimes
'Step Over' worked, but I don't know exact
conditions, but I have never seen green line when
JSP breakpoint is reached.

I've done this:

1. I created small web module with simple build
script with build (which creates war) and clean
targets.
2. I created new web project with existing ant
from my web module.
3. I started bundled tomcat in debug mode.
4. I built project and manually deployed created
war to tomcat by tomcat's html manager.
5. I attached debugger to tomcat.
6. I opened Source window and unchecked usage of
src.zip for debugging (another bug)
7. I created breakpoint in index.jsp
8. I opened index.jsp in browser.
9. Breakpoint was reached, but no green line
appeared in editor.
10. I pressed F8, but debugger continued as I
would press Ctrl+F5.
Comment 1 Martin Grebac 2004-11-29 10:30:35 UTC
This works when ant debug target is used (there's a bug in doc,
though), doesn't work when attach is used - therefore decreasing
priority and setting tm - we should fix this for 4.1.
Comment 2 zikmund 2004-12-02 13:40:55 UTC
Should be part of release notes:
JSPs in freeform project can't be debugged when attaching debugger to
a process. Use ant debug target as described in help topic 'Writing A
Debug Target for a Free-Form Web Project' instead.

CCing Geertjan for comments.
Comment 3 Libor Kotouc 2005-03-04 13:09:16 UTC
I tried it on my web free-form project. It looks as fixed.
Comment 4 Jiri Skrivanek 2005-03-14 11:54:41 UTC
Not fixed. I can still reproduce it in build 20050314-0449.
Comment 5 Geertjan Wielenga 2005-03-14 13:23:06 UTC
I've just updated the 'Debugging the application' section of the Web Import
Guide for 4.1. Here it is:

http://testwww.netbeans.org/kb/41/import_web.html

It explains how the new web debug target is generated (nothing needs to be
customized, but you can select a different server, port number, transport in the
debug.properties file) and how it is used.
Comment 6 Libor Kotouc 2005-03-14 15:40:16 UTC
Geertjan: the problem here is debugging when attached to debuggee with 'Attach
Debugger...'. It does not relate to target generation.

Libor: these problems typically arise when a user does not add web-root
directory to Java Sources (node in project's properties dialog). Debugger then
stops on bp, but does not mark the line with green color and, in addition, is
not able to step.
You can check it in Sources view (if web-root is there then debugger will behave
well).

Could you please verify it?
Comment 7 Geertjan Wielenga 2005-03-14 16:45:35 UTC
"Libor: these problems typically arise when a user does not add web-root
directory to Java Sources (node in project's properties dialog). Debugger then
stops on bp, but does not mark the line with green color and, in addition, is
not able to step. You can check it in Sources view (if web-root is there then
debugger will behave well)."


This is a workaround for Beta, right? In the current build I do not need to do
this any longer.
Comment 8 Jiri Skrivanek 2005-03-15 09:11:07 UTC
No it doesn't work when you use 'Run|Attach Debugger' and try to debug free form
project. If I add web-root directory to Java sources in properties dialog, it
doesn't appear in Sources view. I wonder why it is different from regular web
application project (web-root is not added to Java sources but it appears in
Sources view). web-root for freeform project is also known, so it should be
added to Sources view by default.
Comment 9 Libor Kotouc 2005-03-15 09:31:51 UTC
It is not exact. 

1. 
For debugging via running debug target: stepping works because web-root is added
to the sourcepath (in generated target).
The workaround lasts even now. But this workaround is not mandatory. User will
have to add web-root if he wants to see web-root in Sources view. 

2.
For debugging via attaching debugger: there is no way how to bring sourcepath to
debugger. If user wants to step he MUST add web-root to Java Sources and check
it in Sources view if needed.

Issue 56345 does not solve the second problem because there is no sourcepath
which we could register along with java sources.

It is a project-settings issue, thus reassigning to freeform.
Comment 10 Andrei Badea 2005-03-15 10:33:31 UTC
The web nature needs to register the web root in GlobalPathRegistry when the
project is opened. This is not currently supported by the freeform project. I
will file an issue.
Comment 11 Andrei Badea 2005-03-16 08:42:00 UTC
This requires an API change and we're in API freeze, so the fix won't make it
for 4.1. Please document the workaround.
Comment 12 Jaroslav Pospisil 2006-03-13 13:42:52 UTC
TM 5.0->TBD
Comment 13 Milan Kubec 2006-06-08 08:35:57 UTC
Done. Webroots of web freeform projects are registered in GlobalPathRegistry by
ProjectOpenedHook as source classpath. Such classpath is then shown in Sources
tab of Debugger output window.

Checking in WebProjectNature.java;
/cvs/web/freeform/src/org/netbeans/modules/web/freeform/WebProjectNature.java,v
 <--  WebProjectNature.java
new revision: 1.11.22.1.2.1; previous revision: 1.11.22.1
done

Diff:
http://www.netbeans.org/source/browse/web/freeform/src/org/netbeans/modules/web/freeform/WebProjectNature.java?r1=1.11.22.1&r2=1.11.22.1.2.1
Comment 14 Jiri Skrivanek 2006-06-08 14:11:56 UTC
Verified in build 20060608-0933.
Comment 15 Andrei Badea 2006-06-08 14:54:10 UTC
The classpath registered in GlobalPathRegistry does not change as the web root
changes (e.g. by the user in the project customizer). The classpath should
change its contents and send property change events just as the classpaths
registered by the Java nature and the template projects do. The classpath
implementation should listen on the project.xml and the property evaluator.

Also it seems the getFile() method could be simplified using
org.netbeans.modules.ant.freeform.spi.support.Util.resolveFile().
Comment 16 Milan Kubec 2006-06-14 09:18:10 UTC
Second try, hopefully better. Webroot classpath changes with project.xml and it
provides property change events.

Checking in WebProjectNature.java;
/cvs/web/freeform/src/org/netbeans/modules/web/freeform/WebProjectNature.java,v
 <--  WebProjectNature.java
new revision: 1.11.22.1.2.2; previous revision: 1.11.22.1.2.1
done

Diff:
http://www.netbeans.org/source/browse/web/freeform/src/org/netbeans/modules/web/freeform/WebProjectNature.java?r1=1.11.22.1.2.1&r2=1.11.22.1.2.2
Comment 17 Jiri Skrivanek 2006-06-21 14:43:19 UTC
Verified.