code: @Override
      public void setRollbackOnly() {
          synchronized (this) {
              // The EJB Specification does not allow this operation from any
              // of the following states.
              if (!isRollbackOnlyAllowed()) // d159152
              {
                  IllegalStateException ise;
  
                  ise = new IllegalStateException("StatefulBean: setRollbackOnly() " +
                                                  "not allowed from state = " +
                                                  getStateName(state));
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      Tr.debug(tc, "setRollbackOnly: " + ise);
  
                  throw ise;
              }
          }
  
          super.setRollbackOnly();
      }
docs: setRollbackOnly - It is illegal to call this method during
  ejbCreate, ejbActivate, ejbPassivate, ejbRemove and also if the
  method being invoked has one of notsupported, supports or never
  as its transaction attribute