title: SSE in Jersey: Could not find a suitable constructor in javax.ws.rs.sse.Sse class
body: <p>I am implementing Server Sent Events with Jersey 2.28 and I can't get the basic examples to work.</p>
  
  <p>Other answers mention a dependency problem, I've added all the necessary dependencies to no avail:</p>
  
  <pre><code>&lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-grizzly2-http&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-grizzly2-servlet&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-json-jackson&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.inject&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-hk2&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-sse&lt;/artifactId&gt;
          &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I basically copy-pasted the example and ran it, I've tried variations found in tutorials such as <a href="https://www.baeldung.com/java-ee-jax-rs-sse" rel="nofollow noreferrer">https://www.baeldung.com/java-ee-jax-rs-sse</a> but it just won't work</p>
  
  <pre><code>    @GET
      @Path("/locations")
      @Produces(MediaType.SERVER_SENT_EVENTS)
      public void getServerSentEvents(@Context SseEventSink eventSink, @Context Sse sse) {
          new Thread(() -&gt; {
              for (int i = 0; i &lt; 10; i++) {
                  try {
                      Thread.sleep(1000);
                  } catch (InterruptedException e) {
                      Thread.currentThread().interrupt();
                  }
                  final OutboundSseEvent event = sse.newEventBuilder().name("message-to-client")
                          .data(String.class, "Hello world " + i + "!").build();
                  eventSink.send(event);
              }
          }).start();
      }
  </code></pre>
  
  <p>Can anyone provide me with the correct implementation for basic SSE using Jersey (I'm using the grizzly implementation)</p>