title: JSON JAX-RS channel: Failed to find resource /HtmlDefaultRepresentation/defaultHtmlEntry.jsp
body: <p>I have JAX-RS JSON channel:</p>
  
  <pre><code>@Path("/data")
  public class DataChannel {
  
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  public Response getGridData(@HeaderParam("Range") String rangeHeader) {
  </code></pre>
  
  <p>The problem is that (usually) on first call I got the exception from Wink's HtmlProvider, while the subsequent calls are processed correclty and the JSON is returned:</p>
  
  <blockquote>
    <p>0000006f servlet       E
    com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An
    exception was thrown by one of the service methods of the servlet
    [de.datev.qmrzsv.rest.ApplicationConfig] in application [qmslmsv_ear].
    Exception created : [javax.ws.rs.WebApplicationException:
    com.ibm.ws.jsp.webcontainerext.JSPErrorReport: JSPG0036E: Failed to
    find resource /HtmlDefaultRepresentation/defaultHtmlEntry.jsp     at
    org.apache.wink.server.internal.providers.entity.html.HtmlProvider.include(HtmlProvider.java:78)
      at
    org.apache.wink.server.internal.providers.entity.html.HtmlProvider.writeTo(HtmlProvider.java:112)
      at
    org.apache.wink.server.internal.providers.entity.html.HtmlProvider.writeTo(HtmlProvider.java:46)
      at
    org.apache.wink.server.internal.providers.entity.html.HtmlSyndEntryProvider.writeTo(HtmlSyndEntryProvider.java:81)
      at
    org.apache.wink.server.internal.providers.entity.html.HtmlSyndEntryProvider.writeTo(HtmlSyndEntryProvider.java:38)
      at
    org.apache.wink.common.internal.providers.entity.FormatedExceptionProvider.writeTo(FormatedExceptionProvider.java:108)
      at
    org.apache.wink.common.internal.providers.entity.FormatedExceptionProvider.writeTo(FormatedExceptionProvider.java:48)
      at
    org.apache.wink.server.internal.handlers.FlushResultHandler.handleResponse(FlushResultHandler.java:199)
      at
    org.apache.wink.server.handlers.AbstractHandler.handleResponse(AbstractHandler.java:38)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:26)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:22)
      at
    org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
      at
    org.apache.wink.server.handlers.AbstractHandler.handleResponse(AbstractHandler.java:39)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:26)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:22)
      at
    org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
      at
    org.apache.wink.server.handlers.AbstractHandler.handleResponse(AbstractHandler.java:39)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:26)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:22)
      at
    org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
      at
    org.apache.wink.server.handlers.AbstractHandler.handleResponse(AbstractHandler.java:39)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:26)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:22)
      at
    org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
      at
    org.apache.wink.server.internal.log.Responses.handleResponse(Responses.java:90)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:26)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:22)
      at
    org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
      at
    org.apache.wink.server.handlers.AbstractHandler.handleResponse(AbstractHandler.java:39)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:26)
      at
    org.apache.wink.server.handlers.ResponseHandlersChain.handle(ResponseHandlersChain.java:22)
      at
    org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
      at
    org.apache.wink.server.handlers.AbstractHandlersChain.run(AbstractHandlersChain.java:60)
      at
    org.apache.wink.server.internal.RequestProcessor.handleRequestWithoutFaultBarrier(RequestProcessor.java:232)
      at
    org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:154)
      at
    org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:124)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)     at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1225)
      at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:775)
      at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:457)
      at
    com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
      at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
      at
    com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3761)
      at
    com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
      at
    com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:975)
      at
    com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
      at
    com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
      at
    com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
      at
    com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
      at
    com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
      at
    com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:87)
      at
    com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at
    com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at
    com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)     at
    com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)   at
    com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)     at
    com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815) Caused by:
    com.ibm.ws.jsp.webcontainerext.JSPErrorReport: JSPG0036E: Failed to
    find resource /HtmlDefaultRepresentation/defaultHtmlEntry.jsp     at
    com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.findWrapper(AbstractJSPExtensionProcessor.java:447)
      at
    com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.getServletWrapper(AbstractJSPExtensionProcessor.java:338)
      at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:965)
      at
    com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1384)
      at
    com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:548)
      at
    org.apache.wink.server.internal.providers.entity.html.HtmlProvider.include(HtmlProvider.java:75)
      ... 58 more Caused by: java.io.FileNotFoundException: JSPG0036E:
    Failed to find resource
    /HtmlDefaultRepresentation/defaultHtmlEntry.jsp   ... 64 more</p>
  </blockquote>
  
  <p>The runtime environment is WebSphere server 8.5. </p>
  
  <p>It looks as on the first time the wrong provider is chosen, the header explicitely states that JSON should be used as response. The HTTP headers sent from client side also implicite state that JSON is expected:</p>
  
  <blockquote>
    <p>Accept    text/html,application/xhtml+xml,application/xml;q=0.9,<em>/</em>;q=0.8
    Accept-Encoding   gzip, deflate Accept-Language   en,de;q=0.5
    Content-Type  application/json</p>
  </blockquote>
  
  <p>What is causing that problem and how to avoid it?</p>