2012-04-27 20 views
4

Jetty startup delayの質問と同様に、Jetty 8.1.2の起動時間は、WEB-INF/libディレクトリの依存性が増すにつれて上昇します。 DEBUGで(20メガバイト〜60〜90秒)Jetty 8.1.2起動遅延

は(-Dorg.eclipse.jetty.LEVEL = DEBUG、この回答Enable Jetty DEBUGも参照)次の行が出力に大量に発生する有効:

2012-04-27 11:13:38.095:DBUG:oeju.Scanner:scanned [/home/.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmpX/webapps]: {} 

答えて

8

これは、すべてのクラスとJarsでサーブレット関連のアノテーションを探しているServlet-API 2.5以降の通常のプロセスです。通常、これは、web.xmlの「メタデータの完全な」オプションで回避できる:桟橋の8.1.2で

<web-app metadata-complete="true" ...> 

これはAnntionConfigurationクラスによって起因する起動を認識しますが、スキャンプロセスはとにかく発生しています。これはJetty 8.1.2の既知の問題Jetty 8.1.2 scans all classes on classpath if there is >= 1xServletContainerInitializer with HandlesTypes on the classpath, regardless of metadata-complete="true"です。

回避策は、パターンを使用してスキャンプロセスに含まれるJARファイルを制限することです。例えば。 Eclipseでは、「/home/.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmpX/contexts/appname」の「jetty-context.xml」に次のスニペットを追加できます。 xml "ファイル:

<Call name="setAttribute"> 
    <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg> 
    <Arg>.*/.*myPrefixedJarToScan1-[^/]\.jar$|.*/.*myPrefixedJarToScan2-[^/]\.jar$</Arg> 
</Call> 
関連する問題