private Object lookUpJNDI ( String contextName ) { Object result = null ; try { Context ctx = new InitialContext ( ) ; if ( contextName . startsWith ( SecurityConstants . JAAS_CONTEXT_ROOT ) ) result = ctx . lookup ( contextName ) ; else result = ctx . lookup ( SecurityConstants . JAAS_CONTEXT_ROOT + contextName ) ; } catch ( Exception e ) { SecurityLogger . ROOT_LOGGER . tracef ( "Look up of JNDI for %s failed with %s" , contextName , e . getLocalizedMessage ( ) ) ; return null ; } return result ; }
Lookup a context in JNDI