简体   繁体   English

Eclipse IDE 调试 servlet 代码变量未在变量选项卡中注册

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

I have following code that implements javax.servlet.Filter .我有以下实现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.在 eclipe中调试(连接到远程 WL 服务器)时,我想查看分配给reqMap的这个继承代码,但是从“变量”选项卡中我没有看到该变量已注册。 I can certainly see value of request.getParameterMap() and all other variables from that tab.我当然可以从该选项卡中看到request.getParameterMap()和所有其他变量的值。 I am not sure why reqMap is not recognized... That is my 1st question.我不确定为什么reqMap不被识别......这是我的第一个问题。

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 .我还注意到在调试servlet代码时,一些语句被跳过,即使我想通过Step Over从断点逐行检查。 I don't understand why.. I want to see a specific stmt but it gets skipped even from Step Over action.我不明白为什么......我想看到一个特定的 stmt,但它甚至从Step Over动作中被跳过。

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();
    

Eclipse does some bizzare things. Eclipse 做了一些奇怪的事情。 But try refreshing your jars and refreshing the project folder.但是尝试刷新您的 jars 并刷新项目文件夹。 There may be a case that you may have gone out of scope.可能有一种情况,你可能已经走出了scope。

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.当正在执行的 class 文件与源文件不匹配时,会出现这两种症状。 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.听起来在该服务器上执行的 jar 文件有一个 class 文件对应于源文件的旧副本。

Try regenerating the deployment (whatever you did to export the classes to run on the server) and restarting the remote server.尝试重新生成部署(无论您如何导出要在服务器上运行的类)并重新启动远程服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM