facebook

Servlet debugging issue

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #196713 Reply

    johnsw
    Member

    I am trying to debug a servlet which extends org.apache.catalina.servlets.WebdavServlet – the (servlet-webdav.) jar file for this servlet exists in my project’s WEB-INF/lib directory. I added it using the import function, and also specified the location of the source files.

    I can see the jar file in the Project’s java build path, and that the source files are available because I “attached” them.

    I can source level debug my own servlet’s code, but as soon as a call is made to the superclass (contained in the jar file), no further source debugging is possible (until control returns to my servlet). For example debugging the following

    protected void service(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    {
        String method = request.getMethod();
    
        // other code here too, removed for clarity
    
        //call the superclass to process the request
        super.service(request, response);
    }

    I get a Source not found for WebdavServlet(WebdavServlet).service(HttpServletRequest, HttpServletResponse) line: 310 message when I try to step into super.service(…

    I need to see what the superclass is doing with the request, and would have expected that the debugger would allow source level debugging of jar files if the source is attached.

    Is there some trick that I am missing?

    #196717 Reply

    Scott Anderson
    Participant

    John,

    You’re correct, source level debugging should be available in the debugger for a library jar if a source code jar is attached. This is all native Eclipse functionality and we do nothing to change it in any way.

    Is there some trick that I am missing?

    The only trick to that is that the jar packaging needs to be correct and not have any additional directories contained in it (ie. src/org/apache instead of org/apache). You might want to check that. Also, how did you attache the source? Did you right-click on the jar icon at the top-level of your project and do it off the properties window?

    Also, when the debugger can’t find source it will prompt with a dialog so you can locate the jar. If the above doesn’t work, you might try removing the source attachment and then stepping into the code again. This should cause the debugger to allow you to specify the jar at that point.

    Please let us know what you find.

    –Scott
    MyEclipse Support

    #196723 Reply

    johnsw
    Member

    The only trick to that is that the jar packaging needs to be correct and not have any additional directories contained in it (ie. src/org/apache instead of org/apache). You might want to check that.

    Wow, you must be looking over my shoulder! 😉

    I did have the source path including several directories above the package tree. I reset the source path to org/apache/… etc, but the debugger still failed to show the source during debugging.

    Also, how did you attache the source? Did you right-click on the jar icon at the top-level of your project and do it off the properties window?

    Yes, I selected properties->java source attachment after right mouse-clicking the jar file in the WEB-INF/lib directory within the project. But the debugger still counldn’t find the source…

    Also, when the debugger can’t find source it will prompt with a dialog so you can locate the jar. If the above doesn’t work, you might try removing the source attachment and then stepping into the code again. This should cause the debugger to allow you to specify the jar at that point.

    Finally I removed all the jars, undeployed, added back the jars to WEB-INF/lib, but did not attach the source. Placed a breakpoint at the call to the superclass’s service method, and same message again, source not found …

    Could this be a bug?

    #196728 Reply

    Scott Anderson
    Participant

    Wow, you must be looking over my shoulder! 😉

    I did have the source path including several directories above the package tree. I reset the source path to org/apache/… etc,

    I told you there was a trick to it. 😉

    Could this be a bug?

    Possibly, but I really doubt it since this is core Eclipse functionality. Try this, if you have the JDK source try stepping into a String method or two. Does the source display?

    Is your source jar really a jar, or a zip file? The reason I ask is that traditionally a .zip is used; I specifically know if a .jar works or not so you might try that.

    Basically, I’d look for a library where the source attachment seems functional and then find out why the problematic one is different.

    –Scott
    MyEclipse Support

    #196735 Reply

    johnsw
    Member

    Possibly, but I really doubt it since this is core Eclipse functionality. Try this, if you have the JDK source try stepping into a String method or two. Does the source display?

    String method = request.getMethod();
    char c = method.charAt(0);

    No. Trying to view the source for charAt failed to locate the source. The similar error “Source not found for String.charAt(int) Line:443” was displayed.

    😳 I have a confession to make. I didn’t jar up the source files – they exist in a hierarchical directory structure according to the package as they were obtained from the jakarta site (inside jakarta-tomcat-5.0.3-src).

    So, then I created a zip file for the org.apache… etc directory tree, and attached that as the source for the jar. Still no dice though.

    Basically, I’d look for a library where the source attachment seems functional and then find out why the problematic one is different.

    For me, it doesn’t look like source level debugging of any included jars works. Also, the debugger doesn’t prompt to try to locate the source files.

    Before trying MyEclipse, I used Eclipse M1 with Sysdeo’s plugin and there source level debugging of the included jars worked OK.

    I wonder if a configuration issue is causing the problem? This is a clean Eclipse 2.1 with MyEclipse, and no other plugins installed.

    #196738 Reply

    Scott Anderson
    Participant

    I wonder if a configuration issue is causing the problem? This is a clean Eclipse 2.1 with MyEclipse, and no other plugins installed.

    Well, I dug into this one a little deeper, just to convince myself that it’s a configuraiton problem, and discovered that it is indeed a bug in MyEclipse. One of our SourceLocator’s appears a tad lazy. I’ve entered the problem into our internal defect tracking system as ‘fixed’ since I went ahead and took care of it. Running down the problem was 95% of fixing it. 🙂

    It will be working properly in the GA release. Thanks very much for working with me to isolate it.

    As a temporary workaround, if you load the source code you want to step through into any java project, even a new one that you’re not deploying, you should be able to.

    –Scott
    MyEclipse Support

    #196754 Reply

    johnsw
    Member

    Thanks, Scott for following through with that.

    I thought I was going mad! 🙂

    #196756 Reply

    Scott Anderson
    Participant

    I thought I was going mad! 🙂

    Actually, I thought you were too. 😉

    Thanks, Scott for following through with that.

    No problem digging into the details; that’s how we find and fix stuff. Thanks again for reporting this. As it turns out this really was a bit of a large bug, at least in my opinion. Do try the workaround to keep rolling though. It should work fine for you.

    –Scott
    MyEclipse Support

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Servlet debugging issue

You must be logged in to post in the forum log in