title: Injected service keeps throwing NullPointerException
body: <p>When accessing the injected service as below <code>test()</code> throws a <code>NullPointerException</code>.<br>
  If I do not inject but use a new instance of <code>BugService</code> the <code>NPE</code> will be thrown at next step: <code>BugService</code>'s <code>getItems()</code>.<br>
  Actually I find it really hard to understand the JEE6-Tutorial's Section on CDI, so I guess I am missing something quite basic. Appreciate your help.</p>
  
  <p>This is the Java Class:</p>
  
  <pre><code>package hoho.misc;
  
  import java.io.Serializable;
  import javax.inject.Inject;
  import javax.inject.Named;
  import hoho.service.BugService;
  
  @Named
  public class Printer implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Inject
      BugService bs;
  
      public static void main(String[] args) {
          Printer lPrinter = new Printer();
          System.out.println(lPrinter.test());
      }
  
      public String test(){
          String result = bs.getItems().toString();
          return result;
      }
  }
  </code></pre>
  
  <p>And the injected service:</p>
  
  <pre><code>package hoho.service;
  
  import java.util.List;
  import javax.ejb.Stateless;
  import javax.persistence.EntityManager;
  import javax.persistence.PersistenceContext;
  import hoho.model.generated.Item;
  
  /**
   * Session Bean implementation class ItemService
   */
  @Stateless
  public class BugService {
  
     /**
      * Default constructor.
      */
     public BugService() {
     }
  
     @PersistenceContext
     EntityManager em;
  
     @SuppressWarnings("unchecked")
     public List&lt;Item&gt; getItems() {
        return this.em.createQuery(
                "SELECT i FROM Item i")
                .getResultList();
     }   
  }
  </code></pre>
  
  <p>my jboss-deployment-structure.xml</p>
  
  <pre><code>&lt;jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0"&gt;
    &lt;deployment&gt;
      &lt;exclusions&gt;
        &lt;module name="org.jboss.resteasy.resteasy-atom-provider" /&gt;
        &lt;module name="org.jboss.resteasy.resteasy-cdi" /&gt;
        &lt;module name="org.jboss.resteasy.resteasy-jaxrs" /&gt;
        &lt;module name="org.jboss.resteasy.resteasy-jaxb-provider" /&gt;
        &lt;module name="org.jboss.resteasy.resteasy-jackson-provider" /&gt;
        &lt;module name="org.jboss.resteasy.resteasy-jsapi" /&gt;
        &lt;module name="org.jboss.resteasy.resteasy-multipart-provider" /&gt;
        &lt;module name="org.jboss.resteasy.async-http-servlet-30" /&gt;
        &lt;module name="org.apache.log4j" /&gt;
      &lt;/exclusions&gt;
    &lt;/deployment&gt;
  &lt;/jboss-deployment-structure&gt;
  
  &lt;!-- 
  &lt;jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0"&gt;
          &lt;deployment&gt;
                   &lt;exclusions&gt;
                          &lt;module name="org.jboss.as.jaxrs"/&gt;
                   &lt;/exclusions&gt;
          &lt;/deployment&gt;
  &lt;/jboss-deployment-structure&gt;
   --&gt;
  </code></pre>
  
  <p>this is my beans.xml</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://docs.jboss.org/cdi/beans_1_0.xsd"&gt;
  
  &lt;/beans&gt;
  </code></pre>