001
014
015 package com.liferay.portal.spring.jndi;
016
017 import com.liferay.portal.kernel.jndi.JNDIUtil;
018 import com.liferay.portal.kernel.log.Log;
019 import com.liferay.portal.kernel.log.LogFactoryUtil;
020 import com.liferay.portal.kernel.util.PropsKeys;
021 import com.liferay.portal.util.PropsUtil;
022
023 import java.util.Properties;
024
025 import javax.naming.Context;
026 import javax.naming.InitialContext;
027
028
031 public class JndiObjectFactoryBean
032 extends org.springframework.jndi.JndiObjectFactoryBean {
033
034 @Override
035 protected Object lookup() {
036 try {
037 Properties properties = PropsUtil.getProperties(
038 PropsKeys.JNDI_ENVIRONMENT, true);
039
040 Context context = new InitialContext(properties);
041
042 return JNDIUtil.lookup(context, getJndiName());
043 }
044 catch (Exception e) {
045 _log.error("Unable to lookup " + getJndiName());
046
047 return null;
048 }
049 }
050
051 private static Log _log = LogFactoryUtil.getLog(
052 JndiObjectFactoryBean.class);
053
054 }