一、配置
剛下載的解壓版的apache-tomcat,啟動后,通過瀏覽器訪問:http://127.0.0.1:8080/(或者http://localhost:8080)然后點擊下圖的Server status
在登錄界面輸入用戶名 both 和密碼 tomcat 后出現下面的錯誤提示:
HTTP Status 403 - Access to the requested resource has been denied
問題原因:
D:\apache-tomcat\conf 目錄下的
tomcat-users.xml 文件內容如下:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename='tomcat'/>
<role rolename='role1'/>
<user username='tomcat' password='tomcat' roles='tomcat'/>
<user username='role1' password='tomcat' roles='role1'/>
<user username='both' password='tomcat' roles='tomcat,role1'/>
</tomcat-users>
問題修改:將tomcat-users.xml 文件內容改為
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename='tomcat'/>
<rolerolename='role1'/>
<role rolename='admin-gui'/>
<role rolename='manager-gui'/>
<user username='zhangsan' password='admin' roles='admin-gui,manager-gui'/>
<user username='tomcat' password='tomcat' roles='tomcat'/>
<user username='role1' password='tomcat' roles='role1'/>
<user username='both' password='tomcat' roles='tomcat,role1'/>
</tomcat-users>
重新啟動Tomcat ,在登錄時使用 用戶名 zhangsan密碼 admin 登錄即可。
其中<role rolename='admin-gui'/>角色只可以進行Host Manager 管理,不能進行Server Status 和 Manager App 管理;<role rolename='manager-gui'/>角色可以進行Server Status 和 Manager App 管理(不能進行Host Manager管理)
二、項目部署
在myeclipse的對應項目上右擊/Export 在彈出的對話框中選擇JavaEE/WAR file(MyEclipse)將該項目導入到某個位置(不妨是桌面) 進入Tomcat管理頁面(http://localhost:8080)點擊Manager App,進入管理應用界面,在WAR file to deploy(如下圖:) 選擇剛才到處的WAR文件即可,然后就可以咋上面的應用列表中看到自己剛部署的項目。
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
