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. React-router4 第二篇url-params url参数

    官方文档 以下代码均来自于官方文档 上来一步走 import React from 'react' import { BrowserRouter as Router, Route, Link } fr ...

  2. git 本地仓库与远程仓库的连接

    在远程如github新建一个项目名称为blog, 本地项目为store,是一个laravel框架项目,首先用 git init初始化本目,然后用git remote add origin git@gi ...

  3. PAT 1038 统计同成绩学生(20)(代码)

    1038 统计同成绩学生(20)(20 分) 本题要求读入N名学生的成绩,将获得某一给定分数的学生人数输出. 输入格式: 输入在第1行给出不超过10^5^的正整数N,即学生总人数.随后1行给出N名学生 ...

  4. gdal source code c++ make windows

    下载源码 GDAL源代码下载地址:http://trac.osgeo.org/gdal/wiki/DownloadSource,或者安装svn从源代码服务器下载,svn地址是:http://svn.o ...

  5. laravel错误1071 Specified key was too long; max key length is 1000 bytes

    Laravel 5.5 环境,php artisan migrate 之后,出现错误如题. 检查了一下,代码是这样的: $table->increments('id'); $table-> ...

  6. 20165213 java学习第一周

    20165213 -2018-2<Java程序设计>第一周学习总结 教材学习内容总结 java的四个特点:面向对象.平台无关性.动态性.简单. java编写程序步骤:再有jdk的情况下,先 ...

  7. Spring 属性注入(四)属性键值对 - PropertyValue

    Spring 属性注入(四)属性键值对 - PropertyValue Spring 系列目录(https://www.cnblogs.com/binarylei/p/10117436.html) P ...

  8. Linux搭建SVN

    Linux搭建SVN 服务器 1 安装SVN 官网下载:http://subversion.apache.org/packages.html SVN客户端:TortoiseSVN,官网下载:http: ...

  9. linux- Fedora25 下 解决anacondas3 与ibus冲突问题

    问题:当我们安装了anaconda3之后,会发现ibus-setup进不去. 原因: 是因为ibus-setup的python应该使用python2. 而当我们安装了anaconda3之后,调用pyt ...

  10. SecureCRT乱码解决

    本文不涉及编码,只说明ssh问题产生的乱码 如果终端中输出以下字符,就会出现乱码 echo -e '\xe' 还有 ctrl+v,ctrl+n也能产生乱码 恢复方法 echo -e '\xf'