mariusz-s
mariusz-s

Reputation: 1766

EXIT_ON_INIT_FAILURE in Jetty-9.3.12 standalone server

Is there any equivalent of EXIT_ON_INIT_FAILURE from Tomcat in Jetty? I have war which throws IllegalArgumentException during start up (in Spring Bean initialization), but Jetty only prints WARN from DeploymentManager (Unable to reach node goal: started) and started normally (of course with no context). I have tried options:

<?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>

but with no results.

Logs from 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

Thanks in advance for any advice how it should be configured.

Upvotes: 1

Views: 221

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49462

Your DTD is outdated.

Use:

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

Get rid of the block ...

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

The rest is all that's needed in your ${jetty.base}/webapps/${context}.xml file to trigger the failure.

Upvotes: 1

Related Questions