2 Replies Latest reply on Nov 5, 2015 11:56 AM by Daniel Novo

    Undertow error page for 404

    Daniel Novo Newbie

      Hi,

       

      I'm using wildfly 8.2 and i'm trying to set up a custom error page for error 404.

       

      This is my undertow subsystem configuration:

       

      <subsystem xmlns="urn:jboss:domain:undertow:1.2">

                  <buffer-cache name="default"/>

                  <server name="default-server">

                      <http-listener name="default" socket-binding="http" redirect-socket="https"/>

        <https-listener name="https" socket-binding="https" security-realm="SSLRealm"/>

                      <host name="default-host" alias="localhost">

                          <location name="/" handler="welcome-content"/>

                          <filter-ref name="server-header"/>

                          <filter-ref name="x-powered-by-header"/>

        <filter-ref name="404-handler"/>

                      </host>

                  </server>

                  <servlet-container name="default">

                      <jsp-config/>

                      <websockets/>

                  </servlet-container>

                  <handlers>

                      <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>

                  </handlers>

                  <filters>

                      <response-header name="server-header" header-name="Server" header-value="WildFly/8"/>

                      <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

        <error-page name="404-handler" code="404" path="${jboss.home.dir}/welcome-content/ErrorPage.html"/>

                  </filters>

              </subsystem>

       

      When i try to access http:localhost:8080 i'm getting 500 - internal server error.

      In my log i'm getting a nullpointerexception:

       

      15:10:29,685 ERROR [io.undertow.request] (default I/O-1) Undertow request failed HttpServerExchange{ GET /}: java.lang.NullPointerException

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:42)

              at io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:51)

              at io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:51)

              at io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:53)

              at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:76)

              at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49)

              at io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:158)

              at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)

              at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:181)

              at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:108)

              at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:49)

              at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.3.0.Final.jar:3.3.0.Final]

              at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) [xnio-api-3.3.0.Final.jar:3.3.0.Final]

              at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88) [xnio-nio-3.3.0.Final.jar:3.3.0.Final]

              at org.xnio.nio.WorkerThread.run(WorkerThread.java:539) [xnio-nio-3.3.0.Final.jar:3.3.0.Final]