Similar to the question Jetty startup delay the startup time for a Jetty 8.1.2 raises with increasing amount of dependencies in the WEB-INF/lib directory. (20mb ~60 to 90 seconds)
With DEBUG enabled (-Dorg.eclipse.jetty.LEVEL=DEBUG, see also this Answer Enable Jetty DEBUG) the following line occurs massively in output:
2012-04-27 11:13:38.095:DBUG:oeju.Scanner:scanned [/home/.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmpX/webapps]: {}
This is a normal process since Servlet-API 2.5 which is looking for Servlet related Annotations in all Classes and Jars. Normally this could be avoided with the "metadata-complete" option in the web.xml:
<web-app metadata-complete="true" ...>
In Jetty 8.1.2 this is recognized due startup by the AnntionConfiguration Class but the scanning process occurs anyway. This is an known ISSUE Jetty 8.1.2 scans all classes on classpath if there is >= 1xServletContainerInitializer with HandlesTypes on the classpath, regardless of metadata-complete="true" for Jetty 8.1.2.
A workaround is to use a pattern to limit the JAR files which will be included in the scanning process. E.g. in Eclipse you can append the following snippet to the "jetty-context.xml" in "/home/.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmpX/contexts/appname.xml" file:
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
<Arg>.*/.*myPrefixedJarToScan1-[^/]\.jar$|.*/.*myPrefixedJarToScan2-[^/]\.jar$</Arg>
</Call>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With