enonic / lib-static

Library for serving static assets through XP, optimized for client caching
Apache License 2.0
0 stars 0 forks source link

Devmode: NPE before returing found assets from service using the lib #44

Closed espen42 closed 3 years ago

espen42 commented 3 years ago

In prod mode, after adding a few log lines to src/main/resources/lib/enonic/static/index.es6 # getResponse200:

2021-03-06 21:07:46,263 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js) getResponse200:

2021-03-06 21:07:46,270 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js) {path, resource, etag} (object with keys: ["path","resource","etag"]): {
  "path": "/static/myStaticStuff/images/image.jpeg",
  "resource": {},
  "etag": "\"09c8d6d1ebede8bf\""
}
2021-03-06 21:07:46,273 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js) contentType (string): "image/jpeg"
2021-03-06 21:07:46,276 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js) cacheControlFunc.toString() (string): "function () {\n      return DEFAULT_CACHE_CONTROL;\n    }"
2021-03-06 21:07:46,276 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js)

2021-03-06 21:07:46,286 INFO  com.enonic.app.react4xp - (/services/testLibStatic/testLibStatic.js) response (object with keys: ["status","body","contentType","headers"]): {
  "status": 200,
  "contentType": "image/jpeg",
  "headers": {
    "Cache-Control": "public, max-age=31536000, immutable",
    "ETag": "\"09c8d6d1ebede8bf\""
  }
}

This produces an image output.

In devmode however, it appears the service itself fails, since it's able to log the output from getResponse200 before failing with a 500:

2021-03-06 21:04:28,293 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js) getResponse200:

2021-03-06 21:04:28,301 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js) {path, resource, etag} (object with keys: ["path","resource","etag"]): {
  "path": "/static/myStaticStuff/images/image.jpeg",
  "resource": {}
}
2021-03-06 21:04:28,304 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js) contentType (string): "image/jpeg"
2021-03-06 21:04:28,307 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js) cacheControlFunc.toString() (string): "function () {\n      return DEFAULT_CACHE_CONTROL;\n    }"
2021-03-06 21:04:28,307 INFO  com.enonic.app.react4xp - (/lib/enonic/static/index.js)

2021-03-06 21:04:28,320 INFO  com.enonic.app.react4xp - (/services/testLibStatic/testLibStatic.js) response (object with keys: ["status","body","contentType","headers"]): {
  "status": 200,
  "contentType": "image/jpeg",
  "headers": {
    "Cache-Control": "public, max-age=31536000, immutable"
  }
}
2021-03-06 21:04:28,329 ERROR c.e.x.p.i.e.ExceptionRendererImpl - Internal Server Error
com.enonic.xp.web.WebException: null
    at com.enonic.xp.web.impl.exception.ExceptionMapperImpl.map(ExceptionMapperImpl.java:33)
    at com.enonic.xp.portal.handler.BasePortalHandler.handleError(BasePortalHandler.java:60)
    at com.enonic.xp.portal.handler.BasePortalHandler.doHandle(BasePortalHandler.java:52)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.impl.trace.TraceWebFilter.doHandle(TraceWebFilter.java:38)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.impl.handler.WebDispatcherImpl.dispatch(WebDispatcherImpl.java:44)
    at com.enonic.xp.web.impl.handler.WebDispatcherServlet.doHandle(WebDispatcherServlet.java:142)
    at com.enonic.xp.web.impl.handler.WebDispatcherServlet.service(WebDispatcherServlet.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at com.enonic.xp.web.impl.dispatch.mapping.ServletDefinitionImpl.service(ServletDefinitionImpl.java:40)
    at com.enonic.xp.web.impl.dispatch.pipeline.ServletPipelineImpl.service(ServletPipelineImpl.java:40)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.portal.impl.idprovider.IdProviderFilter.doHandle(IdProviderFilter.java:45)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.impl.auth.BasicAuthFilter.doHandle(BasicAuthFilter.java:34)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.impl.context.ContextFilter.lambda$doHandle$0(ContextFilter.java:33)
    at com.enonic.xp.context.ContextImpl.callWith(ContextImpl.java:102)
    at com.enonic.xp.web.impl.context.ContextFilter.doHandle(ContextFilter.java:32)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.vhost.impl.VirtualHostFilter.doHandle(VirtualHostFilter.java:60)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.impl.dos.DosFilterWrapper.doFilter(DosFilterWrapper.java:65)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at org.eclipse.jetty.servlets.HeaderFilter.doFilter(HeaderFilter.java:117)
    at com.enonic.xp.web.impl.header.HeaderFilterWrapper.doHandle(HeaderFilterWrapper.java:51)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterPipelineImpl.filter(FilterPipelineImpl.java:39)
    at com.enonic.xp.web.impl.dispatch.DispatchServletImpl.service(DispatchServletImpl.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:569)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:739)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:249)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:501)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException: null
    at com.enonic.xp.portal.impl.controller.PortalResponseSerializer.populateHeaders(PortalResponseSerializer.java:172)
    at com.enonic.xp.portal.impl.controller.PortalResponseSerializer.serialize(PortalResponseSerializer.java:80)
    at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.doExecute(ControllerScriptImpl.java:73)
    at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.lambda$execute$0(ControllerScriptImpl.java:36)
    at com.enonic.xp.trace.Tracer.traceEx(Tracer.java:72)
    at com.enonic.xp.trace.Tracer.trace(Tracer.java:51)
    at com.enonic.xp.trace.Tracer.trace(Tracer.java:98)
    at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.execute(ControllerScriptImpl.java:36)
    at com.enonic.xp.portal.impl.handler.service.ServiceHandlerWorker.execute(ServiceHandlerWorker.java:106)
    at com.enonic.xp.portal.impl.handler.service.ServiceHandler.doHandle(ServiceHandler.java:64)
    at com.enonic.xp.portal.impl.handler.service.ServiceHandler.doHandle(ServiceHandler.java:23)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.portal.handler.BasePortalHandler.doHandle(BasePortalHandler.java:46)
    ... 91 common frames omitted
2021-03-06 21:04:28,365 ERROR c.e.x.p.i.e.ExceptionRendererImpl - Internal Server Error
com.enonic.xp.web.WebException: null
    at com.enonic.xp.web.impl.exception.ExceptionMapperImpl.map(ExceptionMapperImpl.java:33)
    at com.enonic.xp.portal.handler.BasePortalHandler.handleError(BasePortalHandler.java:60)
    at com.enonic.xp.portal.handler.BasePortalHandler.doHandle(BasePortalHandler.java:52)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.impl.trace.TraceWebFilter.doHandle(TraceWebFilter.java:38)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.impl.handler.WebDispatcherImpl.dispatch(WebDispatcherImpl.java:44)
    at com.enonic.xp.web.impl.handler.WebDispatcherServlet.doHandle(WebDispatcherServlet.java:142)
    at com.enonic.xp.web.impl.handler.WebDispatcherServlet.service(WebDispatcherServlet.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at com.enonic.xp.web.impl.dispatch.mapping.ServletDefinitionImpl.service(ServletDefinitionImpl.java:40)
    at com.enonic.xp.web.impl.dispatch.pipeline.ServletPipelineImpl.service(ServletPipelineImpl.java:40)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:45)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.portal.impl.idprovider.IdProviderFilter.doHandle(IdProviderFilter.java:45)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.impl.auth.BasicAuthFilter.doHandle(BasicAuthFilter.java:34)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.impl.context.ContextFilter.lambda$doHandle$0(ContextFilter.java:33)
    at com.enonic.xp.context.ContextImpl.callWith(ContextImpl.java:102)
    at com.enonic.xp.web.impl.context.ContextFilter.doHandle(ContextFilter.java:32)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.vhost.impl.VirtualHostFilter.doHandle(VirtualHostFilter.java:60)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.impl.dos.DosFilterWrapper.doFilter(DosFilterWrapper.java:65)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at org.eclipse.jetty.servlets.HeaderFilter.doFilter(HeaderFilter.java:117)
    at com.enonic.xp.web.impl.header.HeaderFilterWrapper.doHandle(HeaderFilterWrapper.java:51)
    at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31)
    at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33)
    at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:41)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36)
    at com.enonic.xp.web.impl.dispatch.pipeline.FilterPipelineImpl.filter(FilterPipelineImpl.java:39)
    at com.enonic.xp.web.impl.dispatch.DispatchServletImpl.service(DispatchServletImpl.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:569)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:739)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:249)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:501)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException: null
    at com.enonic.xp.portal.impl.controller.PortalResponseSerializer.populateHeaders(PortalResponseSerializer.java:172)
    at com.enonic.xp.portal.impl.controller.PortalResponseSerializer.serialize(PortalResponseSerializer.java:80)
    at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.doExecute(ControllerScriptImpl.java:73)
    at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.lambda$execute$0(ControllerScriptImpl.java:36)
    at com.enonic.xp.trace.Tracer.traceEx(Tracer.java:72)
    at com.enonic.xp.trace.Tracer.trace(Tracer.java:51)
    at com.enonic.xp.trace.Tracer.trace(Tracer.java:98)
    at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.execute(ControllerScriptImpl.java:36)
    at com.enonic.xp.portal.impl.handler.service.ServiceHandlerWorker.execute(ServiceHandlerWorker.java:106)
    at com.enonic.xp.portal.impl.handler.service.ServiceHandler.doHandle(ServiceHandler.java:64)
    at com.enonic.xp.portal.impl.handler.service.ServiceHandler.doHandle(ServiceHandler.java:23)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75)
    at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30)
    at com.enonic.xp.portal.handler.BasePortalHandler.doHandle(BasePortalHandler.java:46)
    ... 91 common frames omitted
espen42 commented 3 years ago

Reproduced independently in two different apps, and seems to happen from webapp.js too - not just services.

Effects all kinds of asset types (which all work in prod).

espen42 commented 3 years ago

Problem was that a key under response.headers had a value that was undefined. This was obfuscated in the log. In this case it was the ETag header, but any key in .headers with an undefined value will cause this crash, it seems.

espen42 commented 3 years ago

https://github.com/enonic/xp/issues/8699