code: @Override
      public Principal getCallerPrincipal() {
          synchronized (this) {
              if ((state == PRE_CREATE) || (state == CREATING) || (!allowRollbackOnly))
                  throw new IllegalStateException();
          }
  
          return super.getCallerPrincipal();
  
      }
docs: getCallerPrincipal is invalid if called within the setSessionContext
  method