1 Reply Latest reply on Jul 15, 2005 9:00 PM by bill.burke

    @Init methods throw exception TransactionRequiredException

    triathlon98

      I have a ejb 3.0 sfsb with the EntityManager injected, using ejb2.1 clients.

      In the @Init methods, the sfsb looks up the entity to work on. Strangely enough this sometimes fails with the following exception (only relevant part )

      Caused by: javax.persistence.TransactionRequiredException: EntityManager must be access within a transaction
       at org.jboss.ejb3.entity.ManagedEntityManagerFactory.getSession(ManagedEntityManagerFactory.java:117)
       at org.jboss.ejb3.entity.InjectedEntityManager.getSession(InjectedEntityManager.java:149)
       at org.jboss.ejb3.entity.InjectedEntityManager.find(InjectedEntityManager.java:87)
       at be.unid.test.om.server.pm.DMVehicleFinder.findUOID(DMVehicleFinder.java:230)
       at be.unid.test.om.server.VehicleBean.init(VehicleBean.java:141)
       at be.unid.test.om.server.VehicleBean.ejbCreate(VehicleBean.java:127)
       ... 18 more
      


      How can I prevent this exception?