1 Reply Latest reply on Jun 2, 2011 3:37 PM by lightguard

    Seam-persistence : Lookup of UserTransaction not allowed...

    baraber

      I am using successfully seam-persistence in my application.  However, one of my bean cannot use an injected entity-manager :



      Caused by: javax.naming.NameNotFoundException: Lookup of java:comp/UserTransaction not allowed for Container managed Transaction beans

      here is my code :


      @TransactionAttribute
      public class CurrentFileStore {
          @Inject
          @Client
          EspaceClient currentWorkspace;
          
          @Inject
          EntityManager em;
          
          @Produces
          @SessionScoped
          public FileStore getCurrentFileStore() {
              TypedQuery<FileStore> query = em.createQuery("SELECT store FROM FileStore store WHERE store.name = ?1", FileStore.class);
              query.setParameter(1, currentWorkspace);
              FileStore store = query.getSingleResult();
              return store;
          }
      }
      


      Is this because of the producer method ?  Like I said before, I also have a Service only annotated @TransactionAttribute, injecting the entity manager in the same way, but the service is working perfectly.


      Can someone help or explain if I'm doing wrong ?