麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 網站 > Tomcat > 正文

SSM項目頻繁打成war包部署,使用tomcat和maven實現熱部署配置

2024-09-06 19:00:58
字體:
來源:轉載
供稿:網友

背景

眾所周知,我們平時將JavaEE項目開發完后,需要將項目部署到服務器的tomcat上。常用的部署方式是將項目打包成war包放到tomcat的webapps下,然后重啟tomcat,然后通過ip地址+端口號訪問。這樣部署本身是沒問題的,但問題在于,如果還是在生產環境下的話,需要頻繁的更改優化項目,那么就需要頻繁的將項目打war包,替換webapps下的war包,操作繁瑣。

接下來我們講述如何實現本地編程,然后部署項目到遠程服務器的tomcat上,實現熱部署。

所用技術&工具

maven(項目構建和依賴管理) tomcat7插件 (部署到tomcat的插件) tomcat服務器 (web服務器) 編譯器推薦使用IDEA

1.確保本地具有遠程tomcat的使用權限

修改Tomcat下{TOMCAT_HOME}conf/tomcat-users.xml配置文件,添加用戶名、密碼、權限。

<role rolename="manager-gui" /><role rolename="manager-script" /><role rolename="admin-gui" /><role rolename="admin-script" /><user username="tomcat" password="tomcat" roles="manager-gui,manager-script,admin-gui,admin-script"/>

2.配置Tomcat允許遠程訪問

在遠程服務器的{TOMCAT_HOME}conf/Catalina/localhost/目錄下創建一個manager.xml文件,配置如下內容:

<?xml version="1.0" encoding="UTF-8"?><Context privileged="true" antiResourceLocking="false" docBase="${catalina.home}/webapps/manager">     <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /></Context>

注:如果只想部分用戶使用,可在allow配置IP,例如

allow="192.168.0.102"

3.重啟遠程Tomcat

在tomcat的bin目錄下依次執行

//關閉tomcat./shutdown.sh//啟動tomcat./startup.sh

4.測試是否具有使用權限

訪問tomcat,例如http://192.168.0.102:8080(使用自己的服務器或是虛擬機的ip地址)
點擊Manager APP


在這里插入圖片描述

輸入剛才配置的tomcat的賬號和密碼

在這里插入圖片描述

如果跳轉到這個頁面證明配置完成

在這里插入圖片描述

當然也可以在當前頁面實現war的部署和替換,這也是另一種部署方式,不過依然沒有熱部署方便

問題:如果出現403報錯如下

403 Access DeniedYou are not authorized to view this page. By default the Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Manager's context.xml file. If you have already configured the Manager application to allow access and you have used your browsers back button, used a saved book-mark or similar then you may have triggered the cross-site request forgery (CSRF) protection that has been enabled for the HTML interface of the Manager application. You will need to reset this protection by returning to the main Manager page. Once you return to this page, you will be able to continue using the Manager application's HTML interface normally. If you continue to see this access denied message, check that you have the necessary permissions to access this application. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 日韩视频一二三 | 国产正在播放 | 爱逼爱操综合网 | 久久成人亚洲 | 亚洲精品成人18久久久久 | 午夜精品毛片 | 国产成人强伦免费视频网站 | h视频在线观看免费 | 91精品国产日韩91久久久久久360 | 日本一级黄色毛片 | 久久精品欧美电影 | av在线中文| 欧美一区在线观看视频 | 欧美日韩大片在线观看 | 国产成年人小视频 | 一本色道久久综合狠狠躁篇适合什么人看 | 国产乱淫a∨片免费观看 | 成人视屏网站 | www.com国产精品 | av影院在线 | www.com超碰| 久国产精品视频 | 日本在线观看视频网站 | 91精品国产乱码久久久久久久久 | 一级视频在线播放 | 一级黄色免费观看 | 国产1级视频 | av成人免费在线观看 | 男女羞羞视频 | 久草在线新时代视觉 | 国产精品美女久久久免费 | 色视频一区二区 | 羞羞答答tv | 一级α片免费看刺激高潮视频 | 亚洲网站免费观看 | 欧美另类69xxxxx 视频 | 美国av免费看 | 国产99视频精品免视看9 | 久久精品国产久精国产 | 成人免费视频视频在线观看 免费 | 国产精品91在线 |