/Users/qiudeqing/Desktop/tools/apache-tomcat-7.0.62
vim ~/.bash_profile
输入以下内容: PATH=$PATH:/Users/qiudeqing/Desktop/tools/apache-tomcat-7.0.62/bin
export PATH
startup.sh
, 输出启动信息.浏览器访问http://localhost:8080
看到换页页面说明成功终端运行: shutdown.sh
conf/tomcat-users.xml
添加以下内容
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
每次都打包war并拷贝到webapp目录比较麻烦, 配置虚拟路径之后tomcat可以找到webapp之外的web
在tomcat目录下新建conf/Catalina/localhost/<project-name>.xml
,其中
<?xml version="1.0" encoding="UTF-8"?>
<Context
docBase="/Users/qiudeqing/Desktop/java/struts2-demos/target/struts2-demos"
reloadable="true">
</Context>
其中docBase
为web app目录.
<Host>标签中
<Context path="/" docBase="chemgood.war" debug="0" privileged="true" reloadable="true"/>
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />
tomcat线上debug 编辑tomcat根目录下的bin/catalina.sh脚本,增加我们刚刚得到配置
export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,suspend=n,server=y"