What is taking long on Jetty startup?

Viewed 2033

Starting Jetty there's a long delay (8s) before my web application starts loading

13:50:10 [INFO] jetty-9.4.5.v20170502
13:50:18 [INFO] Scanning elapsed time=146ms

With debug logging turned on there are two interesting steps

  • Extracting dependent war-application, which takes time after all (3s)

    10:03:13 [DEBUG] Extracting entry = null from jar file:[..]/application-1.0.war
    10:03:16 [DEBUG] Unpacked overlay: jar:file:[..]/application-1.0.war!/ to file:[..]
    
  • and the below 4s delay:

    10:03:16 [DEBUG] Service loaders found in 0ms
    10:03:20 [DEBUG] loaded interface javax.servlet.ServletContainerInitializer
    

How can I debug or affect what's causing above 4s delay?


Configuration

pom.xml

<dependency>
    <groupId>com.company</groupId>
    <artifactId>application</artifactId>
    <version>1.0</version>
    <type>war</type>
</dependency>

[...]

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.4.5.v20170502</version>
    <configuration>
        <webApp>
            <webInfIncludeJarPattern>empty</webInfIncludeJarPattern>
            <containerIncludeJarPattern>empty</containerIncludeJarPattern>
        </webApp>
    </configuration>
</plugin>

web.xml

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
     version="3.1" 
     metadata-complete="true">

   <context-param>
       <param-name>contextClass</param-name>
       <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
   </context-param>

   <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>com.app.AnnotationConfig</param-value>
   </context-param>

   <listener>
       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>

   [...]

</web-app>
1 Answers
Related