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. dev-server.js浅析

    // 检查NodeJS和npm的版本 require('./check-versions')() // 获取配置 var config = require('../config') // 如果Node ...

  2. Vue 全局注册逐渐 和 局部注册组件

    //定义一个名为 button-counter 的新组件 Script: Vue.component('button-counter',{//button-counter 这个是组件的名字 data: ...

  3. tp框架版本的thinksnsnv4开启调试模式

    首先说下开启调试模式完整操作. 1.\config\config.inc.php配置文件中增加两个键值对 'APP_DEBUG' => true, 'SHOW_PAGE_TRACE' => ...

  4. c# 关于取小数点后值四舍五入精度问题

    ---恢复内容开始--- 最近做一个校验码验证法算法的生成程序,涉及到取小数点后值的问题;对其中遇到的问题做一下总结: 1:ToString()转换时碰到0.9999999999999之类的数据,给自 ...

  5. nginx与php-fpm原理

    一.正向代理与反向代理 1.正向代理:访问google.com google.com   vpn需要FQ才能访问 vpn 对于我们来说是可以感知到的(我们连接vpn),但对于google服务器是不知道 ...

  6. PAT 1076 Wifi密码(15)(代码)

    1076 Wifi密码(15 分) 下面是微博上流传的一张照片:"各位亲爱的同学们,鉴于大家有时需要使用 wifi,又怕耽误亲们的学习,现将 wifi 密码设置为下列数学题答案:A-1:B- ...

  7. Andriod——手机尺寸相关的概念 +尺寸单位+关于颜色

    手机的尺寸: 屏幕对角线的长度,单位为英寸(2.54cm) 手机的分辨率: 屏幕能显示的像素的数量, 一般用在长方向上数量*宽方向上数量来表达 手机的像素密度: pixels per inch,也称P ...

  8. hdu 5455 (2015沈阳网赛 简单题) Fang Fang

    题目;http://acm.hdu.edu.cn/showproblem.php?pid=5455 题意就是找出所给字符串有多少个满足题目所给条件的子串,重复的也算,坑点是如果有c,f以外的字符也是不 ...

  9. js对象(BOM部分/DOM部分)

    JS总体包括ECMAScript,DOM,BOM三个部分,但是能够和浏览器进行交互的只有DOM和BOM,那么到底什么是DOM和BOM呢 概念 BOM(Browser Object Model)是指浏览 ...

  10. fedora如何删除某个包且不删除依赖它的相关包

    背景: 软件包编译过程中需要安装依赖,yum-builddep   SRPMS/xxx.src.rpm, 有时会遇到“多库版本保护”的问题,从而导致无法安装其他版本的依赖包 解决办法: rpm -e ...