调试 Java Web 应用程序的步骤是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3221768/
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-10-30 00:50:54  来源:igfitidea点击:

What are the Steps for Debugging Java Web Application?

javadebugging

提问by Rachel

I joined a project which has been already developed and its an Web Application deployed on Tomcat Server.

我加入了一个已经开发的项目,它是一个部署在 Tomcat 服务器上的 Web 应用程序。

I have configured the Web Application on my local Tomcat Server and it is running fine. I want to start debugging the Application but I am not sure where to start from and how to debug an Java Web Application from Eclipse and so my question is

我已经在本地 Tomcat 服务器上配置了 Web 应用程序,并且运行良好。我想开始调试应用程序,但我不确定从哪里开始以及如何从 Eclipse 调试 Java Web 应用程序,所以我的问题是

Q:How to Debug Java Web Application which is running on Tomcat Server on Local Machine in Eclipse Environment {Pointers to useful resources or other steps would be highly appreciated}?

问:如何在 Eclipse 环境中调试在本地机器上的 Tomcat 服务器上运行的 Java Web 应用程序{指向有用资源或其他步骤的指针将不胜感激}

采纳答案by krock

There are at least a couple of ways to do this:

至少有几种方法可以做到这一点:

回答by Dunderklumpen

I have had to do this a few times. Often it is not convenient to create a Dynamic web project to debug a web application in tomcat. This technique is fairly simple but requires some configuration in tomcat and then using Elcipse (or netbeans) to attach to tomcat when its running.

我不得不这样做几次。在tomcat中创建动态web项目调试web应用往往不方便。这种技术相当简单,但需要在 tomcat 中进行一些配置,然后在运行时使用 Elcipse(或 netbeans)附加到 tomcat。

http://wiki.apache.org/tomcat/FAQ/Developing, in particular

http://wiki.apache.org/tomcat/FAQ/Developing,特别是

How do I configure Tomcat to support remote debugging?and How do I remotely debug Tomcat using Eclipse?

如何配置Tomcat支持远程调试?以及 如何使用 Eclipse 远程调试 Tomcat?

回答by david paavada

Just stop your server from normal start mode and click on debug mode. Soon, after the server shows debugging,synchronised, continue using the web apps as you do normally. But before that, you must provide breakpoints and you can see the results that you need.

只需从正常启动模式停止您的服务器,然后单击调试模式。很快,在服务器显示 后debugging,synchronised,继续像往常一样使用网络应用程序。但在此之前,您必须提供断点,您才能看到所需的结果。

Works for me.

对我来说有效。

回答by Thorbj?rn Ravn Andersen

First get the Java EE edition of Eclipse

首先获取Java EE版的Eclipse

You then need to have the Eclipse project containing the WEB-INF folder be a Dynamic Web Project. Then the full tooling becomes available and allow you to work with your projects inside any server including Tomcat. The trick is to locate the Server view pane, and right click to add a new Tomcat server adapter.

然后,您需要将包含 WEB-INF 文件夹的 Eclipse 项目设为动态 Web 项目。然后就可以使用完整的工具,并允许您在包括 Tomcat 在内的任何服务器中处理您的项目。诀窍是找到“服务器”视图窗格,然后右键单击以添加新的 Tomcat 服务器适配器。