use Eclipse| a Web application

创建一个简单的web项目

AServlet.java

package cn.zno;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; public class AServlet extends HttpServlet {
private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append("Served at: ").append(request.getContextPath()); } }

AServlet.java

web.xml

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>AServlet</servlet-name>
<display-name>AServlet</display-name>
<description></description>
<servlet-class>cn.zno.AServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AServlet</servlet-name>
<url-pattern>/AServlet</url-pattern>
</servlet-mapping>
</web-app>

web.xml

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.zno</groupId>
<artifactId>za</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>za Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provider</scope>
</dependency> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>za</finalName>
</build>
</project>

pom.xml

构建一个war

[INFO] Building war: F:\e\workspacetest\za\target\za.war

部署到远程tomcat并以debug模式启动

%CATALINA_HOME%/webapps/

webapps
│ host-manager
│ manager
│ ROOT
│ za.war

设置debug模式的参数(通过setenv.bat设置)

%CATALINA_HOME%/bin/  下添加文件 setenv.bat 内容如下

set "JAVA_OPTS= -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y %JAVA_OPTS%"

如下图:

该文件会自动被catalina.bat 执行

启动

F:\e\tomcat\apache-tomcat-7.0.70\bin>startup.bat

会出现挂起的tomcat

启动debugger

远程电脑tomcat会继续执行,将 za 部署,日志如下:

Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.70
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jun 15 2016 16:27:45 UTC
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.70.0
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: F:\e\java\jdk1.8.0_101\jre
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_101-b13
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: F:\e\tomcat\apache-tomcat-7.0.70
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: F:\e\tomcat\apache-tomcat-7.0.70
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Xdebug
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.config.file=F:\e\tomcat\apache-tomcat-7.0.70\conf\logging.properties
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=F:\e\tomcat\apache-tomcat-7.0.70\endorsed
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=F:\e\tomcat\apache-tomcat-7.0.70
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=F:\e\tomcat\apache-tomcat-7.0.70
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=F:\e\tomcat\apache-tomcat-7.0.70\temp
Sep 20, 2016 12:18:23 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\e\java\jdk1.8.0_101\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;F:\e\java\jdk1.8.0_101\bin;C:\Program Files\TortoiseSVN\bin;E:\apache-ant-1.9.6\bin;C:\Program Files\Git\cmd;F:\e\maven\apache-maven-3.2.5\bin;.
Sep 20, 2016 12:18:23 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Sep 20, 2016 12:18:23 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 838 ms
Sep 20, 2016 12:18:23 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 20, 2016 12:18:23 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.70
Sep 20, 2016 12:18:23 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive F:\e\tomcat\apache-tomcat-7.0.70\webapps\za.war
Sep 20, 2016 12:18:24 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(F:\e\tomcat\apache-tomcat-7.0.70\webapps\za\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Sep 20, 2016 12:18:24 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive F:\e\tomcat\apache-tomcat-7.0.70\webapps\za.war has finished in 551 ms
Sep 20, 2016 12:18:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory F:\e\tomcat\apache-tomcat-7.0.70\webapps\host-manager
Sep 20, 2016 12:18:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory F:\e\tomcat\apache-tomcat-7.0.70\webapps\host-manager has finished in 127 ms
Sep 20, 2016 12:18:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory F:\e\tomcat\apache-tomcat-7.0.70\webapps\manager
Sep 20, 2016 12:18:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory F:\e\tomcat\apache-tomcat-7.0.70\webapps\manager has finished in 92 ms
Sep 20, 2016 12:18:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory F:\e\tomcat\apache-tomcat-7.0.70\webapps\ROOT
Sep 20, 2016 12:18:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory F:\e\tomcat\apache-tomcat-7.0.70\webapps\ROOT has finished in 79 ms
Sep 20, 2016 12:18:24 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Sep 20, 2016 12:18:24 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 20, 2016 12:18:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 977 ms

访问浏览器

http://localhost:8080/za/AServlet

即可进入到AServlet中的断点

浏览器页面加载中且进入到了Eclipse中的断点

继续执行后,浏览器显示结果

Remote Debugging (3)的更多相关文章

  1. 在chrome 总调试cordova出现Detached from the target. Remote debugging has been terminated with reason: Connection lost. Please re-attach to the new target

    在chrome 总调试cordova出现如下错误: "Detached from the target. Remote debugging has been terminated with ...

  2. 转:Remote debugging with Visual Studio 2010

    Original URL http://www.codeproject.com/Articles/146838/Remote-debugging-with-Visual-Studio-2010 you ...

  3. Remote Debugging (1)

    The client/server design of the Java debugger allows you to launch a Java program from computer on y ...

  4. JPDA and Set up Tomcat for Remote Debugging

    * About JPDA (http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/architecture.html) JPDA: (J ...

  5. 安卓手机移动端Web开发调试之Chrome远程调试(Remote Debugging)

    一.让安卓打debug模式的apk包 二.将电脑中的chrome升级到最新版本,在chrome浏览器地址栏中输入chrome://inspect/#devices: 在智能手机还未普及时,移动设备的调 ...

  6. Android WebView remote debugging

    /***************************************************************************** * Android WebView rem ...

  7. Android/iOS Remote debugging

    简单介绍 使用下面方法可以定位webview中的元素,无法定位view中的元素. 原文地址:http://mp.weixin.qq.com/s/y_UfdgjT_pkKgYivJmqt7Q webvi ...

  8. Remote Debugging Android Devices

    Remote Debugging Android Devices //在电脑上远程调试安卓设备 By Kayce Basques Technical Writer at Google By Meggi ...

  9. 通过Chrome浏览器进行android调试/Remote Debugging on Android with Chrome

    The way your web content behaves on mobile can be dramatically different from the desktop experience ...

  10. PyCharm 2017: Remote debugging using remote interpreter doesn't work

    I set up a remote interpreter and verified that I can run a script using the remote interpreter. Con ...

随机推荐

  1. JS打开新窗口,子窗口操作父窗口

    <!--父窗口弹窗代码开始--> <script type="text/javascript"> function OpenWindow() { windo ...

  2. Linux apt-get命令

    一.简介 Ubuntu系列系统包管理工具.   二.常用指令   1.查询功能 apt-cache search package 搜索软件包 apt-cache show package 获取包的相关 ...

  3. Linux CentOS 7 下 Apache Tomcat 7 安装与配置

    前言 记录一下Linux CentOS 7安装Tomcat7的完整步骤. 下载 首先需要下载tomcat7的安装文件,地址如下: http://mirror.bit.edu.cn/apache/tom ...

  4. andorid UI事件

  5. git clone时出现:"diffie-hellman-group1-sha1 "

    解决办法1:在用户配置目录下添加一个ssh配置文件 vim /root/.ssh/config  内容如下: Host * KexAlgorithms +diffie-hellman-group1-s ...

  6. 使用limma、Glimma和edgeR,RNA-seq数据分析易如反掌

    使用limma.Glimma和edgeR,RNA-seq数据分析易如反掌 Charity Law1, Monther Alhamdoosh2, Shian Su3, Xueyi Dong3, Luyi ...

  7. BZOJ 3329 - Xorequ - 数位DP, 矩乘

    Solution 发现 $x \ xor \  2x = 3x$ 仅当 $x$ 的二进制中没有相邻的 $1$ 对于第一个问题就可以进行数位DP 了. 但是对于第二个问题, 我们只能通过递推 打表 来算 ...

  8. 利用gulp搭建less编译环境

       什么是less? 一种 动态 样式 语言. LESS 将 CSS 赋予了动态语言的特性,如 变量, 继承, 运算, 函数. LESS 既可以在 客户端 上运行 (支持IE 6+, Webkit, ...

  9. mysql 查两个表之间的数据差集

    需要查两个表之间的差集 首先,想到的是主键直接not in select mailbox_id from co_user where mailbox_id not in (select mailbox ...

  10. ark是什么

    https://github.com/QuadHex/ARK/releases 0.8.0版本网络使用evpp 调用 https://www.jianshu.com/p/9f09928829ba