生活随笔
收集整理的這篇文章主要介紹了
Tomcat下部署多个项目
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
轉載地址:http://blog.csdn.net/philosophyatmath/article/details/30246631
同一端口號的多個項目部署
??? 添加:
?
<Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrass"/>??<Context?path="/route2"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrasweats"/>?? 通過訪問:http://127.0.0.1:8080/route??http://127.0.0.1:8080/route2?對應各子的項目
?
?
?
?
?
?
?
對應不同端口號的多個項目部署
通過訪問:http://127.0.0.1:8080/route??http://127.0.0.1:8081/route?對應各子的項目????????
??????? 打開conf文件夾server.xml文件,添加
[html]?view plaincopy
<Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrass"/>??
??????? 在service標簽下面寫一個service標簽。復制上面service,再修改里面的端口號為8081。添加:
[html]?view plaincopy
<Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrasweats"/>?? ?
?
[html]?view plaincopy
<?xml?version='1.0'?encoding='utf-8'?>????<Server?port="8054"?shutdown="SHUTDOWN">????<!--?Security?listener.?Documentation?at?/docs/config/listeners.html????<Listener?className="org.apache.catalina.security.SecurityListener"?/>????-->??????<Listener?className="org.apache.catalina.core.AprLifecycleListener"?SSLEngine="on"?/>??????<Listener?className="org.apache.catalina.core.JasperListener"?/>??????<Listener?className="org.apache.catalina.core.JreMemoryLeakPreventionListener"?/>????<Listener?className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"?/>????<Listener?className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"?/>?????????<GlobalNamingResources>?????????<Resource?name="UserDatabase"?auth="Container"????????????????type="org.apache.catalina.UserDatabase"????????????????description="User?database?that?can?be?updated?and?saved"????????????????factory="org.apache.catalina.users.MemoryUserDatabaseFactory"????????????????pathname="conf/tomcat-users.xml"?/>????</GlobalNamingResources>????????<Service?name="Catalina">??????????<Connector?port="8080"?protocol="HTTP/1.1"?????????????????connectionTimeout="20000"?????????????????redirectPort="9543"?/>?????????????<Connector?port="8909"?protocol="AJP/1.3"?redirectPort="9543"?/>????????<Engine?name="Catalina"?defaultHost="localhost">??????????<Realm?className="org.apache.catalina.realm.LockOutRealm">?????????????<Realm?className="org.apache.catalina.realm.UserDatabaseRealm"?????????????????resourceName="UserDatabase"/>????????</Realm>??????????<Host?name="localhost"??appBase="webapps"??????????????unpackWARs="true"?autoDeploy="true">????????????<Valve?className="org.apache.catalina.valves.AccessLogValve"?directory="logs"?????????????????prefix="localhost_access_log."?suffix=".txt"?????????????????pattern="%h?%l?%u?%t?"%r"?%s?%b"?/>??????<Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrass"/>????????</Host>?????????</Engine>??????</Service>???????????<Service?name="Catalina">???????????<Connector?port="8081"?protocol="HTTP/1.1"?????????????????connectionTimeout="20000"?????????????????redirectPort="9543"?/>??????????<Connector?port="8909"?protocol="AJP/1.3"?redirectPort="9543"?/>??????<Engine?name="Catalina"?defaultHost="localhost">????????<Realm?className="org.apache.catalina.realm.LockOutRealm">??????????<Realm?className="org.apache.catalina.realm.UserDatabaseRealm"?????????????????resourceName="UserDatabase"/>????????</Realm>????????<Host?name="localhost"??appBase="webapps"??????????????unpackWARs="true"?autoDeploy="true">??????????<Valve?className="org.apache.catalina.valves.AccessLogValve"?directory="logs"?????????????????prefix="localhost_access_log."?suffix=".txt"?????????????????pattern="%h?%l?%u?%t?"%r"?%s?%b"?/>??????????<Context??path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrasweats"/>????????</Host>??????</Engine>????</Service>??</Server>?? ?
?
Java?home set :
setclasspath.sh
export JAVA_HOME=/home/qatest/jdk1.8.0_91
export JRE_HOME=/home/qatest/jdk1.8.0_91/jre
?
?
?
?
web.xml的加載過程是:
context-param -> listener -> filter -> servlet?
其它:
service httpd status
service httpd restart
lsof -i:80
chmod +x catalina.sh
ps –ef|grep tomcat
rm –rf file
啟動tomcat #?? ./startup.sh
關閉tomcat #?? ./shutdown.sh
查看是否啟動成功可以輸入ps axuwf|grep java,如果出現一大堆結果,就是啟動成功了.
也可以netstat -lnpt,查看8088端口有沒有被使用.如果被使用了,說明啟動成功了.
轉載于:https://www.cnblogs.com/ceshi2016/p/6031203.html
總結
以上是生活随笔為你收集整理的Tomcat下部署多个项目的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。