給新手--安裝tomcat後使用者名稱和密碼設定以及項目怎麼部署在tomcat伺服器上

來源:互聯網
上載者:User

標籤:tomcat

安裝後tomcat伺服器後,登陸首先就是讓輸入使用者名稱和密碼,可是我們在安裝tomcat的過程中好像沒有讓設定使用者名稱和密碼,這時候可能有人就抓狂了,還有的人是突然忘記了使用者名稱和密碼,對於出現這種情況該怎麼去解決呢?

不慌,tomcat安裝的過程中是沒有讓使用者佈建使用者名稱和密碼,因為這個工作是需要使用者自己在設定檔中自己書寫的。過程如下:

以我安裝tomcat的目錄為例  D:\Program Files\apache-tomcat-6.0.35

進入該目錄找到conf檔案下,找到tomcat-users.xml檔案,用記事本開啟它



然後在<tomcat-users></tomcat-users>中間添加<user username="" password="" roles="manager"/>

<tomcat-users><!--  NOTE:  By default, no user is included in the "manager-gui" role required  to operate the "/manager/html" web application.  If you wish to use this app,  you must define such a user - the username and password are arbitrary.--><!--  NOTE:  The sample user and role entries below are wrapped in a comment  and thus are ignored when reading this file. Do not forget to remove  <!.. ..> that surrounds them.--><!--  <role rolename="tomcat"/>  <role rolename="role1"/>  <user username="tomcat" password="tomcat" roles="tomcat"/>  <user username="both" password="tomcat" roles="tomcat,role1"/>  <user username="role1" password="tomcat" roles="role1"/>--><user username="" password="" roles="manager"/> </tomcat-users>

上述代碼中引號可以自己設定使用者名稱和密碼,如果按照我上面所寫的代表是沒有使用者名稱和密碼

這下子大家都清楚了嗎?

安裝好了tomcat,下面就是怎麼將自己的項目部署到tomcat上了

首先在MyEclipse中將tomcat設定好  設定的方法和地方如所示


分別設定JDK  載入方式 Paths不用設定


設定好後,將自己的項目部署到tomcat伺服器上,可以利用IDE MyEclipse來部署,或者直接手動在server.xml中自動部署

開啟剛才的tomcat安裝的conf檔案夾 找到server.xml  開啟在其中加下如下代碼即可

<Context path="/struts2" docBase="D:\MyEclipse 10 WorkSpace\struts2\WebRoot" reloadable="true" />

其中 struts2是項目名稱  docBase是該項目的路徑  reloadable表示當修改設定檔等伺服器自動重新載入


這樣,啟動伺服器即可。

給新手--安裝tomcat後使用者名稱和密碼設定以及項目怎麼部署在tomcat伺服器上

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.