code: public static void checkAccessibility(String resourceName, String adapterName, String embeddedApp, String accessingApp,
                                            boolean isEndpoint) throws ResourceException {
          if (embeddedApp != null) {
              if (!embeddedApp.equals(accessingApp)) {
                  String msg = null;
                  if (isEndpoint) {
                      if (accessingApp != null) {
                          msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8810.embedded.activation.failed",
                                                             new Object[] { resourceName, adapterName, embeddedApp, accessingApp },
                                                             "J2CA8810.embedded.activation.failed");
                      } else {
                          msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8812.embedded.activation.failed",
                                                             new Object[] { resourceName, adapterName, embeddedApp },
                                                             "J2CA8812.embedded.activation.failed");
                      }
                  } else {
                      if (accessingApp != null) {
                          msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8809.embedded.lookup.failed",
                                                             new Object[] { resourceName, adapterName, embeddedApp, accessingApp },
                                                             "J2CA8809.embedded.lookup.failed");
                      } else {
                          msg = TraceNLS.getFormattedMessage(Utils.class, tc.getResourceBundleName(), "J2CA8811.embedded.lookup.failed",
                                                             new Object[] { resourceName, adapterName, embeddedApp },
                                                             "J2CA8811.embedded.lookup.failed");
                      }
                  }
                  throw new ResourceException(msg);
              }
          }
      }
docs: Check accessibility of the resource adapter from the application.
  
  @param resourceName The name of the resource
  @param adapterName The name of the resource adapter
  @param embeddedApp The name of the app in which the resource adapter is embedded
  @param acessingApp The name of the app from which the resource is accessed
  @param isEndpoint Whether the resource is an endpoint.
  @throws ResourceException