Deploying .war at the root in Tomcat

已經把 server.xml 裡的 Context tag 的 docBase=”/path/file.war” path=”/” 但是神奇的是, 連到網站還是顯示 Tomcat 預設的黃色老虎.

把 webapp 目錄裡的 ./ROOT/ 目錄移掉, 再把path=”” 就解決了.


解法:
https://stackoverflow.com/questions/5328518/deploying-my-application-at-the-root-in-tomcat

  1. Remove the out-of-the-box ROOT/ directory from tomcat and rename your war file to ROOT.war before deploying it.
  2. Deploy your war as (from your example) war_name.war and configure the context root in conf/server.xml to use your war file :<Context path="" docBase="war_name" reloadable="true"></Context>

The first one is easier, but a little more kludgy. The second one is probably the more elegant way to do it.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *