Confluence Takes too Long to Start Due to Class Loading
Confluence startup is very slow; it may take up to 20 minutes to complete. This can be seen in the log, where there is a big time gap in the logging messages:
2010-05-16 12:38:46,537 INFO [main\] [com.atlassian.confluence.lifecycle\] contextInitialized Starting Confluence 2.10.1 (build #1517) ... 2010-05-16 12:39:17,292 INFO [main\] [beans.factory.xml.XmlBeanDefinitionReader\] loadBeanDefinitions Loading XML bean definitions from class path resource [jmxContext.xml\] 2010-05-16 13:02:28,192 INFO [main\] [springframework.web.context.ContextLoader\] initWebApplicationContext Root WebApplicationContext: initialization completed in 1391452 ms ...
In thread dumps, there is one thread in RUNNABLE state:
"main" prio=10 tid=0x09991400 nid=0x5163 runnable [0xb7fb0000..0xb7fb41f8\] java.lang.Thread.State: RUNNABLE at java.io.UnixFileSystem.getBooleanAttributes0(Native Method) at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:228) at java.io.File.exists(File.java:733) at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:995) at sun.misc.URLClassPath.getResource(URLClassPath.java:168) at java.net.URLClassLoader$1.run(URLClassLoader.java:192) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) - locked <0x7d570838> (a sun.misc.Launcher$AppClassLoader) ...
As evidenced in the thread dump, the operating system is trying to load class files from the filesystem. The calls have not reached Confluence code yet.
These are the known reasons for this problem:
- The files are located on an NFS share which is currently inaccessible. See further suggestions.
- There is a '/net' directory under the root '/' directory in filesystem being referenced in the classpath. Confluence has some packages that look in 'net' directories. In this case, the '/net' directory is special as it seems to be a 'network' directory. Any file references within the '/net' directory incurs a timeout. Most likely, this directory is created by the automount.
- Re-establish access to inaccessible NFS share
- Remove the '/net' directory from the automount directives