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.