8 Replies Latest reply on Jun 4, 2010 6:05 AM by Alexander Nemsadze

    Seam Managed EntityManager is null In Servlet

    Alexander Nemsadze Newbie

      I have Servlet that fetches some entries from database and marshals them in ZipOutputStream, I use


      new ContextualHttpServletRequest(request) {
                          @Override
                          public void process() throws Exception {
                              doWork(request, response);
                          }
      }.run();
      



      pattern to get seam contexts, then I get my seam component and call method


      ViewPaymentsManager manager = (ViewPaymentsManager)Contexts.lookupInStatefulContexts("viewPaymentsManager");
      manager.initExportPayments();
      List<Payment> payments = manager.getExportPayments();
      



      seam managed entity manager is null inside initExportPayments method. I am sure I have everything right with the entity manager configuration as I use it in all my application, the only problem I have is when I invoke this method from servlet I get nullpointer on entityManager.


      I have also tried to wrap servlet call in UserTransaction but with no result.
      I can't understand is it possible that only partial seam context is availible in servlet and why?


      thanks