LoginSignup
0
0

More than 3 years have passed since last update.

tomcat8.5 では起動時に /WEB-INF/ 以下のTLDファイルを探索する

Last updated at Posted at 2020-04-25

現象

tomcat7 から tomcat8.5に移行した際、起動に時間がかかるようになった。

原因

tomcat8.5 では起動時には、/WEB-INF/以下のTLDファイルを探索する。
/WEB-INF/以下に多くのファイルが存在している、または、シンボリックリンクでネットワーク上のファイルを参照しているような場合では起動に時間がかかってしまう。

ソース

org.apache.jasper.servlet.TldScanner クラスの、220行目の、scanResourcePaths メソッドで、
サブディレクトリを再帰的に探索しているようです


protected void scanResourcePaths(String startPath)
            throws IOException, SAXException {

    boolean found = false;
    if (dirList != null) {
            for (String path : dirList) {
                if (path.startsWith("/WEB-INF/classes/")) {
                    // Skip: JSP.7.3.1
                } else if (path.startsWith("/WEB-INF/lib/")) {
                    // Skip: JSP.7.3.1
                } else if (path.endsWith("/")) {
                    scanResourcePaths(path);
                } else if (path.startsWith("/WEB-INF/tags/")) {
                    // JSP 7.3.1: in /WEB-INF/tags only consider implicit.tld
                    if (path.endsWith("/implicit.tld")) {
                        found = true;
                        parseTld(path);
                    }
                } else if (path.endsWith(TLD_EXT)) {
                    found = true;
                    parseTld(path);
                }
            }
        }
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0