Bug 48179

Summary: After startup seeing java.io.FileNotFoundException:<file path>/tldcache.ser (No such file or directory)
Product: Tomcat 5 Reporter: Samuel Mendenhall <smendenh>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Severity: minor    
Priority: P2    
Version: 5.5.23   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: patch for TC 5.5
patch for TC 6

Description Samuel Mendenhall 2009-11-11 11:10:14 UTC
This issue is seeing in Tomcat 5.5.23 after startup the following exception is seeing:
java.io.FileNotFoundException: <path removed for privacy>/tldCache.ser (No such file or directory)
       at java.io.FileOutputStream.open(Native Method)
       at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
       at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
       at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:317)
       at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4307)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4144)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
       at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:122)
       at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:144)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:738)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
       at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
       at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
       at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
       at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
       at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
       at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)

Note that JSPs are not being used.

This exception doesn't happen when setting processTlds="false" in conf/context.xml but still occurs when setting it in a <context> defined in conf/server.xml, it won't work. 

The processTlds attribute should work in the <Context> in conf/server.xml also as seen here http://tomcat.apache.org/tomcat-5.5-doc/config/context.html  (though not recommended)
Comment 1 Mark Thomas 2010-02-02 08:52:41 UTC
5.5.x tries to write the TLD cache to the work directory. This gets created if ti doesn't exist. At a guess, I'd say the Tomcat process doesn't have the necessary permissions to create the work directory structure.

Please follow up on the users list of you need more assistance.
Comment 2 Konstantin Kolinko 2010-02-03 00:41:51 UTC
There is a minor issue there:

This exception in TldConfig.execute(), and also one in TldConfig.processCache(), 
are processed with

Something like
 log.warn("Failed to write tldCache.ser file", ex);
would provide a better context for this message.

This applies only to 5.5.  In 6.0 the same code is also present, but it is never called (as tldCache is always null there), and thus can be removed instead of trying to fix it.
Comment 3 Konstantin Kolinko 2010-02-03 01:23:22 UTC
Created attachment 24918 [details]
patch for TC 5.5

Patch for TC 5.5 that
- logs TLD cache reading and writing errors
- if reading a TLD cache fails continues TLD scanning, instead of quiting
Comment 4 Konstantin Kolinko 2010-02-03 01:44:18 UTC
Created attachment 24919 [details]
patch for TC 6

Patch for TC 6.0 that removes code responsible for reading and writing the TLD cache file, because it is never called. (tldCache is always null)
Comment 5 Konstantin Kolinko 2010-02-03 01:53:35 UTC
Proposed the patches for 5.5 and 6.0.
Comment 6 Mark Thomas 2010-02-22 21:07:49 UTC
This has been fixed in 6.0.x and will be included in 6.0.25 onwards.
Comment 7 Konstantin Kolinko 2010-05-25 22:53:14 UTC
This has been fixed in 5.5 in r948296 and will be in 5.5.30 onwards.