Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1940

SseEventSourceImpl has no context

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • 3.6.0.Final, 4.0.0.Beta4
    • jaxrs
    • None
    • Hide

      To reproduce, just start a server with a custom `Feature` which calls `ResteasyProviderFactory.getContextData(Dispatcher.class)` and you will notice it will be `null`.

      Show
      To reproduce, just start a server with a custom `Feature` which calls `ResteasyProviderFactory.getContextData(Dispatcher.class)` and you will notice it will be `null`.

    Description

      While working on https://github.com/resteasy/Resteasy/pull/1572 I noticed that the thread running `SseEventSourceImpl` has no thread context set-up for `ResteasyProviderFactory` and will use a singleton instead, which means it has no `Dispatcher` and all other required objects:

      java.lang.RuntimeException: java.lang.NullPointerException
      	at org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:49)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.getInstance(ResteasyProviderFactory.java:741)
      	at org.jboss.resteasy.plugins.providers.sse.InboundSseEventImpl.readData(InboundSseEventImpl.java:194)
      	at org.jboss.resteasy.plugins.providers.sse.InboundSseEventImpl.readData(InboundSseEventImpl.java:182)
      	at org.jboss.resteasy.plugins.providers.sse.InboundSseEventImpl.readData(InboundSseEventImpl.java:172)
      	at org.jboss.resteasy.plugins.providers.sse.InboundSseEventImpl.toString(InboundSseEventImpl.java:236)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at org.jboss.resteasy.plugins.providers.sse.client.SseEventSourceImpl$EventHandler.run(SseEventSourceImpl.java:398)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.lang.NullPointerException
      	at org.resteasy.reactivecontext.ContextFeature.configure(ContextFeature.java:25)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.processProviderContracts(ResteasyProviderFactory.java:2015)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1711)
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1661)
      	at org.jboss.resteasy.plugins.providers.RegisterBuiltin.registerProviders(RegisterBuiltin.java:133)
      	at org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:45)
      	... 15 more
      

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-ema Jim Ma
              separdau@redhat.com Stephane Epardaud
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: