Ich bin daran interessiert, meine Webanwendung mit Maven Jetty Plugin auszuführen. Aber nach einiger Zeit beim Start gibt es den Fehler:
[INFO] Web defaults = org/Eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
2014-08-10 17:39:45.840:INFO:oejs.Server:main: jetty-9.2.2.v20140723
2014-08-10 17:40:54.961:WARN:oejw.WebAppContext:main: Failed startup of context [email protected]{/asd,file:/C:/dev/project/hope/target/asd-1.0/,STARTING}{C:\dev\project\hope\target\asd-1.0.war}
Java.lang.Exception: Timeout scanning annotations
at org.Eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.Java:570)
at org.Eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.Java:440)
at org.Eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.Java:471)
at org.Eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.Java:1329)
at org.Eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.Java:741)
at org.Eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.Java:497)
at org.Eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.Java:365)
at org.Eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.Java:68)
at org.Eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.Java:132)
at org.Eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.Java:114)
at org.Eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.Java:61)
Ich verwende Spring MVC mit Anmerkungen, und ich denke, es gibt ein Problem.
Wenn ich versuche, es über das Eclipse-Jetty-Plugin auszuführen, wird es erfolgreich gestartet, aber mit dem Maven-Plugin wird der Fehler angezeigt.
Irgendwelche Ideen?
Ich habe den gleichen Fehler und zur Behebung dieses Problems sollten Sie Ihrem Startskript (start.ini) Folgendes hinzufügen:
-Dorg.Eclipse.jetty.annotations.maxWait=120
Wenn Sie einen höheren Wert benötigen, setzen Sie 120 für Annotations-Scanning für zwei Minuten. Setzen Sie ihn einfach auf den richtigen Wert.
Eine weitere (meiner Meinung nach) bequeme Art ist, diese Eigenschaft mit einer jetty.xml zu setzen:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.Eclipse.org/jetty/configure.dtd">
<Configure>
<Call name="setProperty" class="Java.lang.System">
<Arg>org.Eclipse.jetty.annotations.maxWait</Arg>
<Arg>120</Arg>
</Call>
</Configure>
Auf diese Weise können Sie die Befehlszeilenargumente weglassen
Es ist sinnlos, alle abhängigen Gläser zu scannen. Sie können das Scan-Muster einschränken, um nur bestimmte Gläser zu finden:
<plugin>
<groupId>org.Eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.8.v20150217</version>
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
<webInfIncludeJarPattern>.*/foo-[^/]*\.jar$|.*/classes/.*</webInfIncludeJarPattern>
</webAppConfig>
</configuration>
</plugin>
Weitere Informationen finden Sie unter webInfIncludeJarPattern
doc: http://www.Eclipse.org/jetty/documentation/9.4.x/jetty-maven-plugin.html#configuring-your-webapp
Der einfachste Weg ist das Hinzufügen der Systemeigenschaft in pom.xml
https://www.Eclipse.org/jetty/documentation/9.4.x/jetty-maven-plugin.html#setting-system-properties