Search code examples
jettybouncycastle

Jetty startup is slow with BouncyCastle included in classpath


I'm using jetty-maven-plugin as a plugin in maven project. Plugin starts up in 2-4 seconds, but when i include org.bouncycastle:bcprov-jdk15on:1.52 as a dependency, the startup time is increased to ~35-60 seconds. What's happening in the background and how can I fix this?


Solution

  • I finally could avoid unnecessary scanning by excluding BC inside jetty-web.xml:

    <Configure class="org.eclipse.jetty.webapp.WebAppContext">
        <Call name="setAttribute">
            <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
            <Arg>^((?!bcprov).)*$</Arg>
        </Call>
    </Configure>
    

    with plugin configuration:

    <contextXml>src/main/webapp/WEB-INF/jetty-web.xml</contextXml>