僕は普段、開発用としてTomcat-9.0.0系を使っています。
先ほどTomcat-9.0.0-M6に更新したら、このようなエラーが出て起動しなくなりました。
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/foobar]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:911) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:890) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/foobar]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:158) ... 6 more Caused by: java.lang.NullPointerException at org.apache.jasper.servlet.TldScanner$TldScannerCallback.scanWebInfClasses(TldScanner.java:395) at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:208) at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262) at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104) at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:103) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5183) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152) ... 6 more
該当箇所のソースは以下の通り。
@Override public void scanWebInfClasses() throws IOException { // This is used when scanAllDirectories is enabled and one or more // JARs have been unpacked into WEB-INF/classes as happens with some // IDEs. Set<String> paths = context.getResourcePaths(WEB_INF + "classes/META-INF"); for (String path : paths) { // ← 395行目 if (path.endsWith(TLD_EXT)) { try { parseTld(path); } catch (SAXException e) { throw new IOException(e); } } } }
見ての通り、pathsがnullです。
なぜだ…?と思って当該アプリケーションのMETA-INFを見てみると、空ディレクトリでした。 もしやと思い、META-INFを消すと元通りに起動するようになりました。まぁ軽いバグの一種なんですかね。
ちなみに、この現象は8.5.2でも起きるようです。(該当箇所のソースが同一なので)