---
title: "tomcat运行过程中提示警告解决办法"
author: "jadethao"
date: "2013-12-05T14:39:36Z"
tags: []
categories: ["开源软件"]
slug: "tomcat"
draft: false
lastmod: "2013-12-13T11:02:00Z"
id: 1985673
url: "https://jadethao.iteye.com/blog/1985673"
---

系统是ubuntu，项目部署在tomcat7之后，运行正常，但是运行一段时间就会提示以下警告：（注：只写一条，其他都是类似）

```xml
十二月 04, 2013 5:10:15 下午 org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "tomcat"
```

虽然不影响程序的运行，但是后台控制台一直提示，所以上网搜索找出现这个现象的原因。

处理这个问题最有效的办法是把tomcat的webappsx下，自带的文件夹全删除之后，问题解决。

也可以按一下方法解决：
原因：
   由于tomcat-users.xml配置有误导致的。
   注：只是部分内容：
  
```xml
 <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"/>
-->
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>
 <user username="zhuo" password="zhuo" roles="manager-gui,manager-script,manager-jmx,manager-status"/>
```

 
 我把空行前半部分给注释掉了。

```xml

 <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"/>

```

 
解决办法如下：
  把空行注释掉的配置放开后，如上的警告消失。