日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Tomcat下部署多个项目

發(fā)布時(shí)間:2025/3/15 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Tomcat下部署多个项目 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

轉(zhuǎn)載地址:http://blog.csdn.net/philosophyatmath/article/details/30246631

同一端口號(hào)的多個(gè)項(xiàng)目部署

??? 添加:

?

  • <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"/>??
  • 通過(guò)訪問(wèn):http://127.0.0.1:8080/route??http://127.0.0.1:8080/route2?對(duì)應(yīng)各子的項(xiàng)目

    ?

    ?

    ?

    ?

    ?

    ?

    ?

    對(duì)應(yīng)不同端口號(hào)的多個(gè)項(xiàng)目部署

    通過(guò)訪問(wèn):http://127.0.0.1:8080/route??http://127.0.0.1:8081/route?對(duì)應(yīng)各子的項(xiàng)目????????
    ??????? 打開(kāi)conf文件夾server.xml文件,添加

    [html]?view plaincopy
  • <Context?path="/route"?reloadable="true"?docBase="/home/develop/tomcat-7.0.54/flatrass"/>??

  • ??????? 在service標(biāo)簽下面寫一個(gè)service標(biāo)簽。復(fù)制上面service,再修改里面的端口號(hào)為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"?/>??
  • ??-->??
  • ??<!--APR?library?loader.?Documentation?at?/docs/apr.html?-->??
  • ??<Listener?className="org.apache.catalina.core.AprLifecycleListener"?SSLEngine="on"?/>??
  • ??<!--Initialize?Jasper?prior?to?webapps?are?loaded.?Documentation?at?/docs/jasper-howto.html?-->??
  • ??<Listener?className="org.apache.catalina.core.JasperListener"?/>??
  • ??<!--?Prevent?memory?leaks?due?to?use?of?particular?java/javax?APIs-->??
  • ??<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">??
  • ?????<!--把port改成8081-->??
  • ????<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的加載過(guò)程是:

    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

    啟動(dòng)tomcat #?? ./startup.sh
    關(guān)閉tomcat #?? ./shutdown.sh
    查看是否啟動(dòng)成功可以輸入ps axuwf|grep java,如果出現(xiàn)一大堆結(jié)果,就是啟動(dòng)成功了.
    也可以netstat -lnpt,查看8088端口有沒(méi)有被使用.如果被使用了,說(shuō)明啟動(dòng)成功了.

    轉(zhuǎn)載于:https://www.cnblogs.com/ceshi2016/p/6031203.html

    總結(jié)

    以上是生活随笔為你收集整理的Tomcat下部署多个项目的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。