2013-06-26 23 views
0

我在Windows 7上安裝了tomcat 7我想部署.war文件。在經歷了幾個與登錄相關的博客和網頁之後Tomcat管理我所做的更改到的conf/tomcat-users.xml文件,現在它看起來像如下:即使在將登錄憑據設置爲tomcat-users.xml文件後,也無法登錄到tomcat 7

<?xml version='1.0' encoding='cp1252'?> 
<!-- 
    Licensed to the Apache Software Foundation (ASF) under one or more 
    contributor license agreements. See the NOTICE file distributed with 
    this work for additional information regarding copyright ownership. 
    The ASF licenses this file to You under the Apache License, Version 2.0 
    (the "License"); you may not use this file except in compliance with 
    the License. You may obtain a copy of the License at 

     http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
--> 
<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"/> 
    <role rolename="admin"/> 
    <role rolename="manager"/> 

    <user username="tomcat" password="tomcat" roles="tomcat"/> 
    <user username="both" password="tomcat" roles="tomcat,role1"/> 
    <user username="role1" password="tomcat" roles="role1"/> 
--> 
<role rolename="tomcat"/> 
    <role rolename="role1"/> 
    <role rolename="admin"/> 
    <role rolename="manager"/> 
    <role rolename="manager-gui"/> 
    <user username="abc" password="abc" roles="manager-gui,admin,manager,tomcat,role1"/> 
</tomcat-users> 

然後我重新啓動本地主機:8080和管理應用程序按鈕,然後顯示登錄屏幕和我有點擊在上面的.xml文件中輸入了登錄信息(abc),但仍然無法登錄。我需要做什麼才能成功登錄。

回答

0

我使用標準的tomcat角色,它的工作原理。嘗試使用它們。 要部署war文件,您只需要manager-gui角色。

<role rolename="manager-gui"/> 
    <role rolename="manager-script"/> 
    <role rolename="manager-jmx"/> 
    <role rolename="admin-gui"/> 
    <role rolename="admin-script"/> 
    <user username="root" password="root" roles="standard, manager-gui, manager-script, manager-jmx, admin-gui, admin-script"/> 
+0

我想你的代碼,但仍面臨着同樣的問題 – NJF

0

在server.xml中從8080端口更改爲8088就職於me.refer下面的代碼

<Connector port="8088" protocol="HTTP/1.1" 
    connectionTimeout="20000" 
    redirectPort="8443" />