码头注释超时原因


问题内容

我想用Maven Jetty插件运行我的Web应用程序。但是在启动一段时间后,它给出了错误:

[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 o.e.j.m.p.JettyWebAppContext@1e2c8{/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)

我正在使用带有注释的spring mvc,我认为这是有问题的。

当我尝试通过eclipse jetty插件运行它时,它会成功启动,但是使用maven插件时,会出现错误。

有任何想法吗?


问题答案:

我遇到了相同的错误,并且要修复它,您应该在启动脚本(start.ini)中添加以下内容:

-Dorg.eclipse.jetty.annotations.maxWait=120

120是用于两分钟的注释扫描,以防您需要更高的值,只需将其设置为适当的值即可。