title: Why is Weblogic container not able to inject the Event object?
body: <p>First of all I want to tell that this question is more about CDI, especially CDI Events. Container ( in my case Weblogic 12 is not able to inject the <code>Event</code> object)</p>
  
  <p><strong>Motivation for the Question:</strong></p>
  
  <p>I am trying to integrate JMS with WebSocket. Basically I am trying to consume a message from JMS and then raise an event so that a server endpoint can receive the JMS message and ultimately raise it to the browser through the WebSocket protocol. I have got the idea to integrate between JMS and WebSocket from this <a href="https://blogs.oracle.com/brunoborges/entry/integrating_websockets_and_jms_with" rel="nofollow">blog</a>.  <strong>Please note that I am not using CDI for any other purpose.</strong>. But I am facing an NPE when I try to fire the injected event. </p>
  
  <p>My understanding is that to use <code>CDI</code> I need to define a <code>beans.xml</code>, even if almost empty.</p>
  
  <p>My <code>beans.xml</code>(I have put this one inside inside <code>WEB-INF</code> directory of my web-app and I have pasted the contents below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>My <code>EventProducer</code> class looks like the following:</p>
  
  <pre><code>public class EventProducer {
      @Inject
      @WSJMSMessage
      Event&lt;DataChangeEvent&gt; wsDeltaEvent;
      boolean raiseEvent = false;
  
      void produceEvent() {
          if (raiseEvent) {
              DataChangeEvent event = new DataChangeEvent(lastSeqNumberOfChangeLists, messageSelector, dataChangeEntries);
              wsDeltaEvent.fire(event); //Raising the NPE because wsDeltaEvent has not been injected.
          }
      }
  }
  </code></pre>
  
  <p>The <code>Event</code> <code>Qualifier</code> is defined thus:</p>
  
  <pre><code>/**
   * Identifies WebSocket JMS messages.
   */
  @Qualifier
  @Retention(RetentionPolicy.RUNTIME)
  @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE})
  
  public @interface WSJMSMessage {
  }
  </code></pre>
  
  <p>The consumer of the event is the method <code>onJMSMessage</code> on the <code>ServerEndpoint</code> class and the relevant portion is pasted below:</p>
  
  <pre><code>@ServerEndpoint(value = "/{projectName}/{businessViewName}/wsdata",
                  encoders = {WSJsonEncoder.class},
                  decoders = {WSJsonDecoder.class})
  public class WebSocketActiveDataHandler {
  
      // Other Lifecycle methods omitted for brevity
  
      public void onJMSMessage(@Observes @WSJMSMessage DataChangeEvent dataChangeEvent) {
          //Something here
      }
  }
  </code></pre>
  
  <p>What am I missing here? Any pointers?</p>