Try to get an object instance by looking in the OSGi service registry
similar to how /com.ibm.ws.jndi/ implements the default namespace.

@return the object instance, or null if an object could not be found
185880
@FFDCIgnore(PrivilegedActionException.class)
    private Object getJNDIServiceObjectInstance(final String className, final String bindingName, final Hashtable<?, ?> envmt) throws Exception {
        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                @Override
                public Object run() throws Exception {
                    return getJNDIServiceObjectInstancePrivileged(className, bindingName, envmt);
                }
            });
        } catch (PrivilegedActionException paex) {
            Throwable cause = paex.getCause();
            if (cause instanceof Exception) {
                throw (Exception) cause;
            }
            throw new Error(cause);
        }
    }
430914
public static GoogleConnector getInstance() {
        if (instance == null) {
            try {
                instance = new GoogleConnector();
            } catch (Exception e) {
                throw new RuntimeException("The GoogleConnector could not be instanced!", e);
            }
        }
        return instance;
    }
314196
public Object getService() {
		Debug.logVerbose("[JdonFramework] enter getService: " + ComponentKeys.PROXYINSTANCE_FACTORY + " in action", module);
		TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder.getTargetMetaRequest();

		targetMetaRequest.setVisitableName(ComponentKeys.PROXYINSTANCE_FACTORY);
		ComponentVisitor componentVisitor = targetMetaRequest.getComponentVisitor();
		return componentVisitor.visit();
	}
961872
@SuppressWarnings("unchecked")
    public static <E> ServiceRegistry<E> getInstance() {
        if (instance == null) {
            synchronized (ServiceRegistry.class) {
                if (instance == null) {
                    instance = new ServiceRegistry<E>();
                }
            }
        }
        return instance;
    }
1332879
protected OSGiInjectionScopeData getInjectionScopeData(NamingConstants.JavaColonNamespace namespace) throws NamingException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        OSGiInjectionScopeData isd = null;

        // Get the ComponentMetaData for the currently active component.
        // There is no comp namespace if there is no active component.
        ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();

        if (cmd == null) {
            NamingException nex = new NamingException(Tr.formatMessage(tc, "JNDI_NON_JEE_THREAD_CWNEN1000E"));
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "getInjectionScopeData : (no CMD) : " + nex.toString(true));
            throw nex;
        }

        isd = injectionEngine.getInjectionScopeData(cmd, namespace);

        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, cmd + " -> " + isd);

        return isd;
    }
1219227
@SuppressWarnings("unchecked")
    public Object[] getInUse() {
        return inUseTable != null ? (((Hashtable<PooledWsByteBufferImpl, PooledWsByteBufferImpl>) inUseTable.clone()).keySet().toArray()) : new Object[0];
    }
513488
@Override
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getObjectInstance", new Object[] { obj, name, nameCtx, environment });
        Object ret = null;

        if (obj instanceof Reference) {
            Reference ref = (Reference) obj;
            String clsName = ref.getClassName();

            if (clsName.equals(ConnectionFactory.class.getName())) {
                ret = this.createConnectionFactory();
                ((JmsConnectionFactory) ret).setReference(ref);
            }

            else if (clsName.equals(QueueConnectionFactory.class.getName())) {
                ret = this.createQueueConnectionFactory();
                ((JmsQueueConnectionFactory) ret).setReference(ref);
            }

            else if (clsName.equals(TopicConnectionFactory.class.getName())) {
                ret = this.createTopicConnectionFactory();
                ((JmsTopicConnectionFactory) ret).setReference(ref);
            }

            else if (clsName.equals(JmsQueueImpl.class.getName())) {
                ret = new JmsQueueImpl(ref);
            }

            else if (clsName.equals(JmsTopicImpl.class.getName())) {
                ret = new JmsTopicImpl(ref);
            }

            else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "class name is " + clsName);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getObjectInstance", ret);
        return ret;
    }
818184
@Override
    public Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt) throws Exception {

        if (tc.isEntryEnabled()) {
            Tr.entry(tc, "getObjectInstance: o=" + o + ",name=" + n + ",context=" + c + ",evnmt=" + envmt);
        }

        if (!(o instanceof Reference)) {
            if (tc.isEntryEnabled()) {
                Tr.exit(tc, "Object " + o + " is not an instance of javax.naming.Reference. Returning null.");
            }
            return null;
        }
        Reference ref = (Reference) o;
        final Class<?> contextClass = Class.forName(ref.getClassName());
        if (tc.isDebugEnabled())
            Tr.debug(tc, "Creating a proxy for type {0}", contextClass);
        Object proxy = null;

        if (Application.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an Application sub-class being injected. Injecting an instance of ApplicationInjectionProxy.");
            }
            proxy = new ApplicationInjectionProxy();
        } else if (HttpServletRequest.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an HttpServletRequest sub-class being injected. Injecting an instance of HttpServletRequestInjectionProxy.");
            }
            proxy = new HttpServletRequestInjectionProxy();
        } else if (HttpServletResponse.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an HttpServletResponse sub-class being injected. Injecting an instance of HttpServletResponseInjectionProxy.");
            }
            proxy = new HttpServletResponseInjectionProxy();
        } else {
            proxy = Proxy.newProxyInstance(priv.getClassLoader(contextClass),
                                           new Class[] { contextClass },
                                           new InvocationHandler() {
                                               @Override
                                               public Object invoke(Object proxy,
                                                                    Method method,
                                                                    Object[] args) throws Throwable {
                                                   // Without these entry and exit calls RAS uses bytecode injection
                                                   // to insert Tr.entry on first line of this method and then Tr.exit
                                                   // on last lie. Tr.entry attempts to call proxy.toString(), which
                                                   // loops back to the invoke method again--hence resulting in a
                                                   // StackOverflowError
                                                   if (tc.isEntryEnabled()) {
                                                       Tr.entry(tc, "invoke");
                                                   }

                                                   Object result = null;
                                                   // use runtimeContext from TLS
                                                   InjectionRuntimeContext runtimeContext = InjectionRuntimeContextHelper.getRuntimeContext();

                                                   if ("toString".equals(method.getName()) && (method.getParameterTypes().length == 0)) {
                                                       result = "Proxy for " + contextClass.getName();
                                                       if (tc.isEntryEnabled()) {
                                                           Tr.exit(tc, "invoke", result);
                                                       }
                                                       return result;
                                                   }

                                                   // get the real context from the RuntimeContext
                                                   Object context = runtimeContext.getRuntimeCtxObject(contextClass.getName());
                                                   if (context != null) {
                                                       result = method.invoke(context, args);
                                                   }

                                                   if (tc.isEntryEnabled()) {
                                                       Tr.exit(tc, "invoke", result);
                                                   }
                                                   // invoke the method on the real context
                                                   return result;
                                               }
                                           });
        }

        if (tc.isEntryEnabled()) {
            Tr.exit(tc, "getObjectInstance", proxy);
        }

        return proxy;

    }
1367284
@Override
    public Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt) throws Exception {
        @SuppressWarnings("unchecked")
        Hashtable<String, Object> env = (Hashtable<String, Object>) envmt;
        return (o instanceof Reference) ? resolve((Reference) o, env) : null;
    }
764779
@Override
	public T get() {
		try {
			return clazz.getConstructor(CharStream.class).newInstance(new Object[] { null });
		}
		catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
1239905
@Override
    public synchronized Subject getSubject () {
        if ( this.cachedSubject != null ) {
            return this.cachedSubject;
        }

        try {
            log.debug("Logging on");
            LoginContext lc;

	    Subject ps = super.getSubject();

            if ( this.configuration != null ) {
                lc = new LoginContext(this.serviceName, ps, this, this.configuration);
            }
            else if ( ps != null ) {
                lc = new LoginContext(this.serviceName, ps, this);
            } else {
                lc = new LoginContext(this.serviceName, this);
	    }
            lc.login();

            Subject s = lc.getSubject();
            if ( log.isDebugEnabled() ) {
                log.debug("Got subject: " + s.getPrincipals());
            }
            if ( log.isTraceEnabled() ) {
                log.trace("Got subject " + s);
            }

            this.cachedSubject = s;
            return this.cachedSubject;
        }
        catch ( LoginException e ) {
            log.error("Failed to create login context", e);
            this.cachedSubject = new Subject();
            return null;
        }
    }
28965
public static String[] getByJNDI() {
        try {
            Class<?> dirContext =
                    Class.forName("javax.naming.directory.DirContext");
            Hashtable<String, String> env = new Hashtable<String, String>();
            env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
            Class<?> initialDirContext =
                    Class.forName("javax.naming.directory.InitialDirContext");
            Constructor<?> constructor = initialDirContext.getConstructor(Hashtable.class);

            Object obj = constructor.newInstance(env);
            Method m = dirContext.getMethod("getEnvironment");
            Hashtable newEnv = (Hashtable) m.invoke(obj);
            String dns = (String) newEnv.get("java.naming.provider.url");
            String dnsTrim = dns.replace("dns://", "");
            return dnsTrim.split(" ");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
689416
protected S getService() {
    // No need to recreate it
    if (service != null) {
      return service;
    }

    Retrofit.Builder retrofitBuilder = new Retrofit.Builder()
      .baseUrl(baseUrl())
      .addConverterFactory(GsonConverterFactory.create(getGsonBuilder().create()));

    if (getCallFactory() != null) {
      retrofitBuilder.callFactory(getCallFactory());
    } else {
      retrofitBuilder.client(getOkHttpClient());
    }

    retrofit = retrofitBuilder.build();
    service = (S) retrofit.create(serviceType);
    return service;
  }
97780
public static Matching getInstance() throws Exception
  {
    if (tc.isEntryEnabled())
      tc.entry(cclass, "getInstance");

    if (instance == null)
      throw createException;

    if (tc.isEntryEnabled())
      tc.exit(cclass, "getInstance", "instance=" + instance);
      
    return instance;
  }
90758
@Override
	public Object getObjectInstance(Object obj, Name name, Context context, Hashtable<?,?> environment) throws Exception
	{
		if (!(obj instanceof Reference))
			throw new IllegalStateException("Object is not a reference : "+obj);
		
        Reference reference = (Reference)obj;
        String objClassName = reference.getClassName();
        
        // Queue
        if (objClassName.equals(QueueRef.class.getName()))
        {
        	String queueName = getRequiredAttribute(reference, "queueName");
        	return new QueueRef(queueName);
        }
        
        // Topic
        if (objClassName.equals(TopicRef.class.getName()))
        {
        	String topicName = getRequiredAttribute(reference, "topicName");
        	return new TopicRef(topicName);
        }
        
        // ConnectionFactory
        if (objClassName.equals(FFMQConnectionFactory.class.getName()))
        	return new FFMQConnectionFactory(recreateConnectionFactoryEnv(reference));
        
        // QueueConnectionFactory
        if (objClassName.equals(FFMQQueueConnectionFactory.class.getName()))
        	return new FFMQQueueConnectionFactory(recreateConnectionFactoryEnv(reference));
        
        // TopicConnectionFactory
        if (objClassName.equals(FFMQTopicConnectionFactory.class.getName()))
        	return new FFMQTopicConnectionFactory(recreateConnectionFactoryEnv(reference));

        // We don't know how to handle this
        return null; 
	}
81830
public Object getObjectInstance(Object obj,
                                    Name name,
                                    Context nameCtx,
                                    Hashtable<?, ?> environment)
                    throws Exception
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "getObjectInstance : " + obj);

        // F743-17630CodRv
        // This factory should only be used from inside an ejb.
        //
        // Checking for the lack of EJBContext is good enough to tell us
        // we are not inside an ejb when the code flow was started by some
        // non-ejb component (such as a servlet).  However, in the case where
        // we've got an ejb that calls into a webservice endpoint, then there
        // may be a ContainerTx that has a BeanO, even though we are not
        // allowed to use the factory from inside the webservice endpoint.
        //
        // To account for this, we must also check the ComponentMetaData (CMD) and
        // confirm that it is ejb specific.  In the webservice endpoint case,
        // the CMD will have been switched to some non-ejb CMD, and so this check
        // so stop us.
        EJBContext ejbContext = EJSContainer.getCallbackBeanO(); // d630940
        ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
        if (ejbContext == null ||
            !(cmd instanceof BeanMetaData))
        {
            InjectionException iex = new InjectionException
                            ("The EJBContext type may only be injected into an EJB instance " +
                             "or looked up within the context of an EJB.");
            Tr.error(tc, "EJB_CONTEXT_DATA_NOT_AVAILABLE_CNTR0329E",
                     new Object[] { EJBContext.class.getName() });
            if (isTraceOn && tc.isEntryEnabled())
                Tr.exit(tc, "getObjectInstance : ", iex);
            throw iex;
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "getObjectInstance : " + ejbContext);

        return ejbContext;
    }
1344985
public static PluginManager getInstance() {
        if (_instance == null) {
            _instance = new PluginManager();
            _instance.classInformation = new HashMap<String, ClassInformation>();
            _instance.methodInformation = new HashMap<String, com.groupon.odo.proxylib.models.Method>();
            _instance.jarInformation = new ArrayList<String>();

            if (_instance.proxyLibPath == null) {
                //Get the System Classloader
                ClassLoader sysClassLoader = Thread.currentThread().getContextClassLoader();

                //Get the URLs
                URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();

                for (int i = 0; i < urls.length; i++) {
                    if (urls[i].getFile().contains("proxylib")) {
                        // store the path to the proxylib
                        _instance.proxyLibPath = urls[i].getFile();
                        break;
                    }
                }
            }
            _instance.initializePlugins();
        }
        return _instance;
    }