Search code examples
javaeclipseremote-debugging

Eclipse IDE debugging servlet code a variable is not registered in the Variables tab


I have following code that implements javax.servlet.Filter. While debugging in eclipe (attach to remote WL server) this inherited code I wanted to vew value assigned to reqMap however from Variables tab I didn't see that variable was registered. I can certainly see value of request.getParameterMap() and all other variables from that tab. I am not sure why reqMap is not recognized... That is my 1st question.

Plz bear with me on 2nd question. I also noticed while debugging servlet code, some statement(s) are skipped even though I wanted to check line by line from a breakpoint via Step Over. I don't understand why.. I want to see a specific stmt but it gets skipped even from Step Over action.

I am hoping someone could enhance my lack of understanding on bizarre debugging problems I ran into.

public class FooFilter implements Filter {
    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain fc) throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest) req;
    
    // I added this stmt as debugging purpose
    Map<String, String[]> reqMap = request.getParameterMap();

    HttpServletResponse response = (HttpServletResponse) resp;
    ServletOutputStream out = response.getOutputStream();
    

Solution

  • There's not a lot of information provided here, but it seems to me the same issue could answer both questions.

    Both of these symptoms would occur when the class file being executed doesn't match the source file. You indicate that you're connecting to a remote server. It sounds like the jar file that's executing on that server has a class file corresponding to an old copy of your source file.

    Try regenerating the deployment (whatever you did to export the classes to run on the server) and restarting the remote server.