Eclipse IDE调试Servlet代码时,在“变量”选项卡中未注册一个变量。

huangapple go评论77阅读模式
英文:

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();
英文:

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&lt;String, String[]&gt; reqMap = request.getParameterMap();

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

答案1

得分: 1

Eclipse做一些奇怪的事情。但是尝试刷新你的JAR包和项目文件夹。可能有一种情况是你可能已经超出了范围。

英文:

Eclipse does some bizzare things. But try refreshing your jars and refreshing the project folder. There may be a case that you may have gone out of scope.

答案2

得分: 0

这里提供的信息有限,但我认为同一个问题可能可以回答这两个问题。

当执行的类文件与源文件不匹配时,会出现这两个症状。您指出正在连接到远程服务器。听起来像是在该服务器上执行的JAR文件具有与您的源文件的旧副本对应的类文件。

尝试重新生成部署(无论您之前是如何导出类以在服务器上运行的),然后重新启动远程服务器。

英文:

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.

huangapple
  • 本文由 发表于 2020年7月29日 05:01:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/63142701.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定