trellis-ldp / trellis

Trellis is a platform for building scalable Linked Data applications
https://www.trellisldp.org
Apache License 2.0
105 stars 21 forks source link

500 response returned from request with Accept: text/html header #1318

Closed jholleran closed 3 years ago

jholleran commented 3 years ago

When running a request with an Accept: text/html header a 500 response is returned,

Steps to reproduce:

Expected

200 response with html representation of the resource,

Actual

500 response code is returned:

* Could not resolve host: GET
* Closing connection 0
curl: (6) Could not resolve host: GET
*   Trying 127.0.0.1:80...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#1)
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.68.0
> Accept: text/html
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< content-length: 0
< 
* Connection #1 to host localhost left intact

Logs from Server

trellis_1  | 2021-04-15 22:15:30,621 ERROR [org.jbo.res.res.i18n] (ForkJoinPool.commonPool-worker-21) RESTEASY002020: Unhandled asynchronous exception, sending back 500: java.lang.NullPointerException
trellis_1  |    at java.base/java.io.Reader.<init>(Unknown Source)
trellis_1  |    at java.base/java.io.InputStreamReader.<init>(Unknown Source)
trellis_1  |    at org.trellisldp.rdfa.DefaultRdfaWriterService.getReader(DefaultRdfaWriterService.java:122)
trellis_1  |    at org.trellisldp.rdfa.DefaultRdfaWriterService.init(DefaultRdfaWriterService.java:95)
trellis_1  |    at org.trellisldp.rdfa.DefaultRdfaWriterService_Bean.create(DefaultRdfaWriterService_Bean.zig:832)
trellis_1  |    at org.trellisldp.rdfa.DefaultRdfaWriterService_Bean.create(DefaultRdfaWriterService_Bean.zig:848)
trellis_1  |    at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
trellis_1  |    at io.quarkus.arc.impl.AbstractSharedContext.access$000(AbstractSharedContext.java:14)
trellis_1  |    at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
trellis_1  |    at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
trellis_1  |    at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
trellis_1  |    at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
trellis_1  |    at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
trellis_1  |    at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:17)
trellis_1  |    at org.trellisldp.rdfa.DefaultRdfaWriterService_ClientProxy.arc$delegate(DefaultRdfaWriterService_ClientProxy.zig:67)
trellis_1  |    at org.trellisldp.rdfa.DefaultRdfaWriterService_ClientProxy.write(DefaultRdfaWriterService_ClientProxy.zig:158)
trellis_1  |    at org.trellisldp.jena.JenaIOService.writeHTML(JenaIOService.java:267)
trellis_1  |    at org.trellisldp.jena.JenaIOService.write(JenaIOService.java:188)
trellis_1  |    at org.trellisldp.jena.JenaIOService_ClientProxy.write(JenaIOService_ClientProxy.zig:169)
trellis_1  |    at org.trellisldp.http.impl.GetHandler.lambda$getLdpRs$7(GetHandler.java:341)
trellis_1  |    at org.jboss.resteasy.plugins.providers.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:37)
trellis_1  |    at org.jboss.resteasy.plugins.providers.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:20)
trellis_1  |    at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.lambda$writeTo$1(ServerWriterInterceptorContext.java:79)
trellis_1  |    at io.quarkus.resteasy.runtime.standalone.VertxHttpRequest$VertxExecutionContext.executeBlockingIo(VertxHttpRequest.java:250)
trellis_1  |    at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.writeTo(ServerWriterInterceptorContext.java:79)
trellis_1  |    at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.syncProceed(AbstractWriterInterceptorContext.java:245)
trellis_1  |    at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.getStarted(AbstractWriterInterceptorContext.java:170)
trellis_1  |    at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.lambda$getStarted$0(ServerWriterInterceptorContext.java:73)
trellis_1  |    at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.aroundWriteTo(ServerWriterInterceptorContext.java:93)
trellis_1  |    at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.getStarted(ServerWriterInterceptorContext.java:73)
trellis_1  |    at org.jboss.resteasy.core.ServerResponseWriter.lambda$writeNomapResponse$3(ServerResponseWriter.java:163)
trellis_1  |    at org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:404)
trellis_1  |    at org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:252)
trellis_1  |    at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:101)
trellis_1  |    at org.jboss.resteasy.core.AsyncResponseConsumer.sendBuiltResponse(AsyncResponseConsumer.java:149)
trellis_1  |    at org.jboss.resteasy.core.AsyncResponseConsumer.internalResume(AsyncResponseConsumer.java:115)
trellis_1  |    at org.jboss.resteasy.core.AsyncResponseConsumer$CompletionStageResponseConsumer.accept(AsyncResponseConsumer.java:239)
trellis_1  |    at org.jboss.resteasy.core.AsyncResponseConsumer$CompletionStageResponseConsumer.accept(AsyncResponseConsumer.java:218)
trellis_1  |    at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
trellis_1  |    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
trellis_1  | 
acoburn commented 3 years ago

This is likely related to the recent class loader changes in Quarkus. We should definitely add an integration test to catch these errors sooner.

acoburn commented 3 years ago

We may have luck using an approach similar to SmallRye-JWT's ResourceUtils class