docs: @Override
      public EJBObject getEJBObject()
      {
          EJBObject result = null;
  
          // d367572.1 start
          if (state == PRE_CREATE || state == DESTROYED)
          {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(tc, "Incorrect state: " + getStateName(state));
              throw new IllegalStateException(getStateName(state));
          }
          // d367572.1 end
  
          try
          {
              //
              // Convert this result to a stub. Stubs are essential
              // to our exception handling semantics as well as to other
              // ORB related behaviors.
              //                                                    d111679 d156807.1
              EJSWrapper wrapper = container.wrapperManager.getWrapper(beanId).getRemoteWrapper();
              Object wrapperRef = container.getEJBRuntime().getRemoteReference(wrapper);
  
              // "The container must implement the SessionContext.getEJBObject
              // method such that the bean instance can use the Java language cast
              // to convert the returned value to the session bean’s remote
              // component interface type. Specifically, the bean instance does
              // not have to use the PortableRemoteObject.narrow method for the
              // type conversion."
              result = (EJBObject) PortableRemoteObject.narrow(wrapperRef, home.beanMetaData.remoteInterfaceClass);
          } catch (IllegalStateException ise) { // d116480
              // FFDC not logged for this spec required scenario
              throw ise;
          } catch (Exception ex) {
              FFDCFilter.processException(ex, CLASS_NAME + ".getEJBObject", "204", this);
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d144064
                  Tr.debug(tc, "getEJBObject() failed", ex);
              throw new IllegalStateException("Failed to obtain EJBObject", ex);
          }
          return result;
      }