解壓縮 apache-tomcat-6.0.35.zip 到 apache-tomcat-6.0.35 目錄。
執行 apache-tomcat-6.0.35/bin/startup.bat,開啟 http://localhost:8080/ 驗證。
刪除 apache-tomcat-6.0.35/webapps 裡 ROOT 以外的所有目錄,刪除 apache-tomcat-6.0.35/conf/Catalina/localhost 裡的 xml 檔,開啟 http://localhost:8080/ 驗證。
刪除 apache-tomcat-6.0.35/webapps/ROOT 裡 index.html 與 WEB-INF 以外的所有檔案目錄。
編輯 apache-tomcat-6.0.35/webapps/ROOT/index.html:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Apache Tomcat</title>
<style type="text/css">
</style>
</head>
<body>
Hello, An Empty Tomcat!
</body>
</html>
開啟 http://localhost:8080/ 驗證。修改 8080 port 為 80 port
開啟 apache-tomcat-6.0.35/conf/server.xml,找到 Connector,將 8080 改為 80:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
開啟 http://localhost/ 驗證。
啟動 Debug 模式
開啟 apache-tomcat-6.0.35/conf/server.xml,找到 set JPDA_TRANSPORT,設定值為 dt_socket,找到 set JPDA_ADDRESS,設定值為 8000 或其他想要的 debug port。
Tomcat 6.0.35 預設已經設定 Debug 如下:
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport set JPDA_TRANSPORT=dt_socket :gotJpdaTransport if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress set JPDA_ADDRESS=8000 :gotJpdaAddress
新增檔案 debug.bat,設定 {TOMCAT_PATH} 到 apache-tomcat-6.0.35 :
@echo off
cd {TOMCAT_PATH}/bin
catalina.bat jpda start
exit
執行 debug.bat,開啟 Eclipse 測試 Debug。Run > Debug Configurations... > 雙點 Remote Java Application > 輸入 Host 與 Port > 按下 Debug。
---
沒有留言:
張貼留言