title: GlassFish ManagedBeanCreationException and NullPointerException
body: <p>I have written an EJB and a dynamic web project Eclipse on GlassFish server. I used DAO , Facade and JPA. Normally I am calling a method from my service it is giving these errors ;</p>
  
  <pre><code>kitapOduncVerme.xhtml]com.sun.faces.mgbean.ManagedBeanCreationException
  
  PWC1406: Servlet.service() for servlet Faces Servlet threw  exceptionjava.lang.NullPointerException 
  at com.mesutemre.kitapislemleri.KitapOduncVermeBean.initList(KitapOduncVermeBean.java:47)   
  at com.mesutemre.kitapislemleri.KitapOduncVermeBean.initialize(KitapOduncVermeBean.java:43)
  </code></pre>
  
  <p>My codes are below;</p>
  
  <pre><code>@ManagedBean(name = "oduncKitapVerBean")
  @ViewScoped
  public class KitapOduncVermeBean implements Serializable{
  
  private static final long serialVersionUID = 1L;
  
  private List&lt;Kitaplar&gt; entityList = new ArrayList&lt;Kitaplar&gt;();
  private Kitaplar selectedEntity;
  private Kitaplar entity;
  private String kullaniciadi;
  
  private KitaplarFacade service;
  
  public KitapOduncVermeBean() {
      entity = new Kitaplar();
      selectedEntity = new Kitaplar();
  
  }
  
  @PostConstruct
  public void initialize(){
      HttpSession session = Util.getSession();
      kullaniciadi = Util.getUserName();
     initList();
  }
  
  private void initList(){
       entityList = service.findAllKitaplar();
  }
  </code></pre>
  
  <p>DaoImpl</p>
  
  <pre><code>@SuppressWarnings("unchecked")
  public List&lt;Kitaplar&gt; findAllKitaplar(){
      return em.createNamedQuery("tumkitaplarigetir").getResultList();
  }
  </code></pre>
  
  <p>Dao</p>
  
  <pre><code>@Stateless
  @LocalBean
  public class KitaplarDAO extends KitaplarDaoImpl&lt;Kitaplar&gt; implements Serializable{
  
  private static final long serialVersionUID = 1L;
  
  @Override
  public List&lt;Kitaplar&gt; findAllKitaplar() {
      return super.findAllKitaplar();
  }
  </code></pre>
  
  <p>FacadeImpl</p>
  
  <pre><code>@Stateless
  @LocalBean
  public class KitaplarFacadeImpl implements KitaplarFacade,Serializable {
  
  
  private static final long serialVersionUID = 1L;
  @EJB
  KitaplarDAO kitapDao;
  
  
  @Override
  public List&lt;Kitaplar&gt; findAllKitaplar() {
      return kitapDao.findAllKitaplar();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Facade</p>
  
  <pre><code>@Local
  public interface KitaplarFacade {
  public abstract List&lt;Kitaplar&gt; findAllKitaplar();
  </code></pre>
  
  <p>}</p>
  
  <p>I can't see any problem in this codes? But Why am I getting that errors?</p>