Jetty-9.3.12独立服务器中的EXIT_ON_INIT_FAILURE

时间:2017-03-16 16:25:30

标签: java spring jetty jetty-9

Jetty中是否有与Tomcat相同的EXIT_ON_INIT_FAILURE?我有war在启动期间抛出IllegalArgumentException(在Spring Bean初始化中),但Jetty只从DeploymentManager打印WARN(无法达到节点目标:启动)并正常启动(当然没有上下文)。我尝试过选项:

<?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
        <Configure class="org.eclipse.jetty.webapp.WebAppContext">
            <Set name="contextPath">{context_path}</Set>
            <Set name="throwUnavailableOnStartupException">true</Set>
            <Set name="war">{war_path}</Set>
            <Set name="maxFormContentSize">10485760</Set>
        </Configure>

但没有结果。

Jetty的日志:

2017-03-16 21:45:05.798:WARN:oejd.DeploymentManager:main: Unable to reach node goal: started
java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'intranetClient' defined in class path resource
{...stacktrace...}
2017-03-16 21:45:05.836:INFO:oejs.AbstractConnector:main: Started httpConnector@48140564{HTTP/1.1,[http/1.1]}{0.0.0.0:5070}
2017-03-16 21:45:05.840:INFO:oejs.AbstractConnector:main: Started httpMngConnector@4439f31e{HTTP/1.1,[http/1.1]}{0.0.0.0:5075}
2017-03-16 21:45:05.841:INFO:oejs.Server:main: Started @40994ms

提前感谢您应该如何配置它。

1 个答案:

答案 0 :(得分:1)

您的DTD已过时。

使用:

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
           "http://www.eclipse.org/jetty/configure_9_3.dtd">

摆脱障碍......

    <Set name="servletHandler">
        <New class="org.eclipse.jetty.servlet.ServletHandler">
            <Set name="startWithUnavailable">false</Set>
        </New>
    </Set>  

其余部分是${jetty.base}/webapps/${context}.xml文件中触发失败所需的全部内容。

相关问题