2016-04-15 82 views
0

我的tomcat管理器没有任何凭据。一切都被评论。当我运行http://localhost:8080/manager/html时,它会询问用户名和密码。当我尝试在没有它们的情况下登录时,它仍然不起作用。我无法编辑文件以取消注释。无法登录到Tomcat管理器

这里是tomcat的-users.xml中

<?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 
t o 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"/> 
--> 

我甚至不认为作为以管理员身份运行括号内打开。我该怎么办?

回答

0

您需要取消注释上述XML中的userrole条目以启用登录用户。

此项目应该让你going- <role rolename="manager"/> <user username="admin" password="admin" roles="manager"/>

我想这不用说,你需要有Tomcat家目录write特权。

P.S.别忘了重启服务器

+0

我知道要取消注释。但是,取消注释后无法保存 – Syed

+0

如果是* nix mahince,请尝试'sudo'。例如。 'sudo vim tomcat-users.xml' –

+0

我使用的是windows。 Sudo仅用于Linux版本,对吧? – Syed