天天看點

Eclipse下配置Tomcat debug

Eclipse下自帶有Tomcat debug插件,不過該插件不會将項目真正釋出到Tomcat中,而是拷貝到插件目錄,如:

/home/clay/work/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps

為了在實際環境中debug,可以如下配置

  1. 點選Debug Configuration,在Apache Tomcat下建立“Remote Tomcat”。
  2. 根據預設生成的Tomcat配置資訊修改Remote Tomcat,例如将VM arguments改為-Dcatalina.base="/home/clay/program/tomcat" -Dcatalina.home="/home/clay/program/tomcat" -Dwtp.deploy="/home/clay/program/tomcat/webapps" -Djava.endorsed.dirs="/home/clay/program/tomcat/endorsed"。
  3. 将tools.jar和bootstrap.jar加入classpath。
  4. 将要debug的項目加入source path。

VM for Liferay:

-Dcatalina.base="/home/clay/program/liferay-portal-5.2.2/tomcat-5.5.27"

-Dcatalina.home="/home/clay/program/liferay-portal-5.2.2/tomcat-5.5.27"

-Dwtp.deploy="/home/clay/program/liferay-portal-5.2.2/tomcat-5.5.27/webapps"

-Djava.endorsed.dirs="/home/clay/program/liferay-portal-5.2.2/tomcat-5.5.27/endorsed"

-Xms128m -Xmx512m

-XX:MaxPermSize=128m

-Djava.io.tmpdir="/home/clay/program/liferay-portal-5.2.2/tomcat-5.5.27/temp"

-Djava.security.auth.login.config="/home/clay/program/liferay-portal-5.2.2/tomcat-5.5.27/conf/jaas.config"

-Dfile.encoding=UTF8 -Duser.timezone=GMT+1