Java 使用 Eclipse 和 Tomcat 问题调试 Spring MVC

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21794633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 10:40:26  来源:igfitidea点击:

Debug Spring MVC with eclipse and Tomcat issue

javadebuggingtomcatspring-mvc

提问by user3221155

I have deployed a Spring MVC application on Tomcat server(eclipse IDE). The application comes up fine but some data is added to list.So wanted to debug . I have added debug points and did "Debug on server" ,the server started in debug mode but it says : Source not found.in the debug view.The control doesnot come to code in application code.

我已经在 Tomcat 服务器(eclipse IDE)上部署了一个 Spring MVC 应用程序。应用程序运行良好,但一些数据被添加到列表中。所以想调试。我添加了调试点并执行了“在服务器上调试”,服务器以调试模式启动,但它说:源未找到。在调试视图中。控件没有在应用程序代码中编码。

Very new to java programming , so I am sure not what i have asked is a silly question .Please help me.Let me know if i need more details.

对 Java 编程非常陌生,所以我确定我问的不是一个愚蠢的问题。请帮助我。如果我需要更多详细信息,请告诉我。

Note I donot use maven or anything like that.

注意我不使用 maven 或类似的东西。

Thanks Siddhi

谢谢悉地

回答by manish

Follow the steps given below:

请按照以下步骤操作:

  1. Start the Tomcat server instance from within Eclipse;
  2. After the server instance has started, open the Debug view. Make sure that the running threads of the application are visible in the view in a hierarchical tree-like structure. The application name should be at the top in this hierarchy;
  3. Stop the Tomcat server instance. The name of the application should still be visible in the Debug view;
  4. Right click the application name and choose Edit Source Lookup;
  5. Select the application root directory as one of the locations where Eclipse should look for the source code;
  6. Start Tomcat server instance again.
  1. 从 Eclipse 中启动 Tomcat 服务器实例;
  2. 服务器实例启动后,打开调试视图。确保应用程序的运行线程在分层树状结构的视图中可见。应用程序名称应位于此层次结构的顶部;
  3. 停止 Tomcat 服务器实例。应用程序的名称仍应在 Debug 视图中可见;
  4. 右键单击应用程序名称并选择“编辑源查找”;
  5. 选择应用程序根目录作为 Eclipse 查找源代码的位置之一;
  6. 再次启动Tomcat 服务器实例。

After the instance has come up, you should be able to debug your source code just fine.

实例启动后,您应该能够很好地调试源代码。