tomcate6+myEclipse10+win配置远程调试

本文介绍如何配置Tomcat以启用远程调试功能,并通过修改startup.bat文件实现。还介绍了如何在MyEclipse中设置远程调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

     在javaWeb开发工作中有时候会遇到一些莫名其妙的问题,在开发环境中程序正常但是将项目发布后会出现这样或者那样的问题,在开发测试环境中又不能重现问题,这时候就需要用到tomcate的远程调试功能。tomcat远程调试用的是JVM的JPDA框架,而tomcat默认是不启用JPDA的,需要我们手动开启。

     一、开启tomcate远程调试的配置

              找到“E:\tomcat.60\bin”在面的startup.bat文件在文件末尾添加如下配置,

                     set JPDA_TRANSPORT=dt_socket
                    set JPDA_ADDRESS=8000
                    set JPDA_SUSPEND=y,

              然后将“call "%EXECUTABLE%" start %CMD_LINE_ARGS%”,

                 修改为 “call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%”。

     说明:            JPDA_ADDRESS:远程调试的端口;

            JPDA_TRANSPORT:jpda的启动方式,有两个值dt_shmem和dt_socket分别表示本机调试和远程调试;

             

    修改后startup.bat配置如下:

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat 908749 2010-02-10 23:26:42Z markt $
rem ---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome

set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"

rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec

rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs

set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=8000
set JPDA_SUSPEND=y

call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%

:end

 到这步tomcate的配置完成,运行startup.bat文件当,出现表示配置成功。

 
    

 

      二、配置好tomcate后,还需要配置myEclipse才能用到远程调试,Myeclipse配置如下图:

           1、选择菜单Run→Debug Configurations              2、添加一个远程调试项目


 点击debug就可以了。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值