Reputation: 359
*Please see EDIT 2 at the end of the post.
I'm able to debug my .java classes with no problem. I attached the debugger using socket (SocketAttach), the host is localhost and the port when I'm in debug mode is 8000.
But I'm trying to debug a function in a jsp page such as
<%
...
ArrayList list = vb.getStuff();
...
Iterator it = list.iterator();
while (it.hasNext()){
...
//I show my list items in a table
...
}
%>
When I put a breakpoint on
ArrayList list = vb.getStuff();
It won't stop on it, even though I see my breakpoint on the right line.
In my Debugger Console, I see
JspLineBreakpoint myPath/mylist.jsp : 48 partially submitted - not into all classes, reason: No executable location available at line 48 in class org.apache.jsp.portal_jsp.
But the breakpoint stays there.
I have one single project in Netbeans, so it doesn't get confuse with other project...
Any help is appreciated, thanks a lot.
P.S: Here's some stuff that can be useful ->
Product Version: NetBeans IDE 8.0.2 (Build 201411181905) Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 2 Java: 1.8.0_65; Java HotSpot(TM) 64-Bit Server VM 25.65-b01 Runtime: Java(TM) SE Runtime Environment 1.8.0_65-b17 System: Windows 7 version 6.1 running on amd64; Cp1252;
EDIT: I forgot to say that I'm using tomcat 7
EDIT 2: I just realized that I can debug the function called from there written in the jsp page..
When I put a breakpoint on
ArrayList list = vb.getStuff();
It won't stop on it, even though I see my breakpoint on the right line.
However, if I put a breakpoint at the first line of that function (which is also in the jsp page), I'll be able to debug it. I guess it's because it is in a function... The previous code with the ArrayList
is not. So the debugger will skip the code executed at first which is not contain in a fucntion...
Any explication on why? Does it think it's part of the "html code" and just skip it, but when it sees I called the function, it debugs it?
Upvotes: 2
Views: 2218
Reputation: 4190
I was having a similar trouble with Netbeans 8.2 and Glassfish 4, but only in some web projects.
The failing project had Web Pages Folder
set to ../other/web2
instead of just web
(it was needed to organize the teamwork).
After copying the resources to web/
I additionally had to clear the Netbeans cache folder to make it work again.
Upvotes: 0
Reputation: 687
This was probably due to the code in your project not matching the code running on the server, though it could also be due to the server type you're using (Weblogic for instance auto gens a servlet class by compiling the jsp whenever it changes). This type of mismatch can make debugging "fun", since some of the code will line up, but other parts won't, making setting and breaking on breakpoints iffy. The best thing to do is rebuild and redeploy, or in debug Sources, set the directory where jsp sources are deployed as a source and remove the project code from Sources. I'm pretty sure this can work when the server is running with a port and definition setup so that you can attach your debugger (as in this case), as opposed to running the server from the IDE. Hope this helped someone (someday...)
Upvotes: 0