javatomcatembedded-tomcat-7embedded-tomcat-8

Embedded Tomcat hangs when starting on deploying app


My embedded tomcat hangs when adding webapp on Linux only. It won't happen during the first time I start it, but from the second boot and beyond.

This happened only after upgrading to Tomcat 8.

When taking a thread dump I see that it's stuck when trying to check access.

Any idea?

"Thread-0@4521" prio=5 tid=0xb nid=NA runnable
  java.lang.Thread.State: RUNNABLE
                  at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:-1)
                  at java.io.File.canRead(File.java:768)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1992)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
                  at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1939)
                  at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1897)
                  at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1149)
                  at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
                  - locked <0x11c0> (a org.apache.catalina.startup.ContextConfig)
                  at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
                  at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
                  at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
                  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5080)
                  - locked <0x11c1> (a org.apache.catalina.core.StandardContext)
                  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
                  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
                  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
                  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
                  at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:550)
                  at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:515)
                  at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:197)
                  at com.my.app.deployment.WebAppsDeployer.loadApplications(WebAppsDeployer.java:51)
                    *****my code****
                  at java.lang.Thread.run(Thread.java:745)

Solution

  • Filed a bug to Apache and the guys there helped me find a solution.