Bug 64184 - Continuously trying to close the conf/tomcat-users.xml if it doesn't exist.
Summary: Continuously trying to close the conf/tomcat-users.xml if it doesn't exist.
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.50
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-28 09:56 UTC by Stefan Roukens
Modified: 2020-03-03 10:32 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Roukens 2020-02-28 09:56:01 UTC
We recently installed TomEE 7.0.7 along with Tomcat 8.5.50. In the previous Tomcat version (8.5.41) shipped with TomEE 7.0.6 we only notices an error message "SEVERE: The specified user database [conf/tomcat-users.xml] could not be found" because we removed the tomcat-users.xml file (we don't use that functionality). In the 8.5.41 version of Tomcat this was no issue the error was only displayed at startup. Now with Tomcat 8.5.50 we notice that it's trying to close the file every 10 seconds. But throws an error because the file does not exists.

Why should it repeatedly try to close the file if it already noticed at startup that the file didn't exists.

Same behaviour also occurs when upgraded to TomEE 8.0.1 along with Tomcat 9.0.30

Below the errors/warnings we noticed in the catalina.out log file:

SEVERE: The specified user database [conf/tomcat-users.xml] could not be found
Feb 28, 2020 9:22:59 AM org.apache.catalina.users.MemoryUserDatabase open
WARNING: Failed to close [conf/tomcat-users.xml]
java.io.FileNotFoundException: /sidn/tomee/rdap/conf/tomcat-users.xml (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at org.apache.catalina.users.MemoryUserDatabase.open(MemoryUserDatabase.java:465)
        at org.apache.catalina.users.MemoryUserDatabaseFactory.getObjectInstance(MemoryUserDatabaseFactory.java:107)
        at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:96)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:839)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
        at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117)
        at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
        at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:132)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:106)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:759)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:688)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)

<SNIP>

Feb 28, 2020 9:23:19 AM org.apache.catalina.users.MemoryUserDatabase backgroundProcess
WARNING: Failed to close [conf/tomcat-users.xml]
java.io.FileNotFoundException: /sidn/tomee/rdap/conf/tomcat-users.xml (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at org.apache.catalina.users.MemoryUserDatabase.backgroundProcess(MemoryUserDatabase.java:700)
        at org.apache.catalina.realm.UserDatabaseRealm.backgroundProcess(UserDatabaseRealm.java:160)
        at org.apache.catalina.realm.CombinedRealm.backgroundProcess(CombinedRealm.java:308)
        at org.apache.catalina.realm.CombinedRealm.backgroundProcess(CombinedRealm.java:308)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1145)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1353)
        at java.lang.Thread.run(Thread.java:748)

<SNIP>

Feb 28, 2020 9:23:29 AM org.apache.catalina.users.MemoryUserDatabase backgroundProcess
WARNING: Failed to close [conf/tomcat-users.xml]
java.io.FileNotFoundException: /sidn/tomee/rdap/conf/tomcat-users.xml (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at org.apache.catalina.users.MemoryUserDatabase.backgroundProcess(MemoryUserDatabase.java:700)
        at org.apache.catalina.realm.UserDatabaseRealm.backgroundProcess(UserDatabaseRealm.java:160)
        at org.apache.catalina.realm.CombinedRealm.backgroundProcess(CombinedRealm.java:308)
        at org.apache.catalina.realm.CombinedRealm.backgroundProcess(CombinedRealm.java:308)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1145)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1353)
        at java.lang.Thread.run(Thread.java:748)
Comment 1 Remy Maucherat 2020-02-28 10:22:12 UTC
If you are not using a component, you should remove it. The MemoryUserDatabase will now monitor conf/tomcat-users.xml (if that's the path used) causing this.
Comment 2 Stefan Roukens 2020-02-28 11:08:52 UTC
How should I achieve to the remove the component?
Comment 3 Christopher Schultz 2020-03-01 19:39:43 UTC
(In reply to Stefan Roukens from comment #0)
> Why should it repeatedly try to close the file if it already noticed at
> startup that the file didn't exists.

If the file doesn't exist at startup, it may be created later and then take effect.

> SEVERE: The specified user database [conf/tomcat-users.xml] could not be
> found
> Feb 28, 2020 9:22:59 AM org.apache.catalina.users.MemoryUserDatabase open
> WARNING: Failed to close [conf/tomcat-users.xml]
> java.io.FileNotFoundException: /sidn/tomee/rdap/conf/tomcat-users.xml (No
> such file or directory)

It looks like there is a confusing error message, here. It's not failing to close the file; it's failing to open it in the first place. It's possible this is an effect of using try-with-resources.
Comment 4 Mark Thomas 2020-03-03 10:32:10 UTC
Fixed in:
- master for 10.0.0-M2 onwards
- 9.0.x for 9.0.32 onwards
- 8.5.x for 8.5.52 onwards