1

I use glassfish 4.1 My code is

    @Stateless
    @TransactionManagement(TransactionManagementType.BEAN)

   public class IslemEJB<T, U> {
     @PersistenceContext(unitName = "etobsSentinelPU")
     private EntityManager em;
     @Resource
     private UserTransaction ut; 
     private T t;
     private U u;

public T updateMesajsizWithReturn(T t) {

    try {
        ut.begin();
        t = em.merge(t);
        em.flush();
        System.out.println(" Log id " + t);
        ut.commit(); 
    }
    catch (RollbackException | HeuristicMixedException | HeuristicRollbackException | IllegalStateException | NotSupportedException | SystemException ex) { 
        Logger.getLogger(IslemEJB.class.getName()).log(Level.SEVERE, null, ex);
        System.out.println(ex); 
        mesaj = "Hata : Güncelleme işlemi sırasında hata meydana geldi. "; 
        durum = false; 
    } 
    catch (SecurityException ex) {...}

And the error is Stateless Session Bean method returned without completing transaction when the application is started.

Lonzak
  • 9,334
  • 5
  • 57
  • 88
aysegulP
  • 443
  • 3
  • 6
  • 18
  • Can you share your `catch` block? Because there can be `RuntimeException` during `em.flush()` and in this case `ut.commit()` won't be called. – Artem Feb 01 '17 at 13:39
  • `} catch (RollbackException | HeuristicMixedException | HeuristicRollbackException | IllegalStateException | NotSupportedException | SystemException ex) { Logger.getLogger(IslemEJB.class.getName()).log(Level.SEVERE, null, ex); System.out.println(ex); mesaj = "Hata : Güncelleme işlemi sırasında hata meydana geldi. "; durum = false; } catch (SecurityException ex) {` – aysegulP Feb 24 '17 at 12:01

0 Answers0