All Downloads are FREE. Search and download functionalities are using the official Maven repository.

panda.util.JndiLookup Maven / Gradle / Ivy

Go to download

Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.

There is a newer version: 1.8.0
Show newest version
package panda.util;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class JndiLookup {
	public static Object lookup(String name) throws NamingException {
		try {
			return ((Context)new InitialContext().lookup("java:comp/env")).lookup(name);
		}
		catch (NamingException e) {
			try {
				return new InitialContext().lookup(name);
			}
			catch (NamingException e2) {
				return ((Context)new InitialContext().lookup("java:/comp/env")).lookup(name);
			}
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy