protected Object lookup(String jndiName, Class requiredType) throws NamingException {
        if (jndiName == null) {
            throw new IllegalArgumentException("jndiName argument must not be null");
        }
        String convertedName = convertJndiName(jndiName);
        Object jndiObject;
        try {
            jndiObject = getJndiTemplate().lookup(convertedName, requiredType);
        } catch (NamingException ex) {
            if (!convertedName.equals(jndiName)) {
                // Try fallback to originally specified name...
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Converted JNDI name [" + convertedName
                            + "] not found - trying original name [" + jndiName + "]. " + ex);
                }
                jndiObject = getJndiTemplate().lookup(jndiName, requiredType);
            } else {
                throw ex;
            }
        }
        LOGGER.debug("Located object with JNDI name '{}'", convertedName);
        return jndiObject;
    }
Perform an actual JNDI lookup for the given name via the JndiTemplate.
<p>If the name doesn't begin with "java:comp/env/", this prefix is added
if "resourceRef" is set to "true".

@param jndiName     the JNDI name to look up
@param requiredType the required type of the object
@return the obtained object
@throws NamingException if the JNDI lookup failed
@see #setResourceRef
core/src/main/java/org/apache/shiro/jndi/JndiLocator.java