//Switch to the portal classloader to ensure the JNDI lookup works
final ClassLoader portalClassLoader = this.getClass().getClassLoader();
currentThread.setContextClassLoader(portalClassLoader);
// create a new InitialContext
final Context cic = new MemoryContext(new Hashtable<Object, Object>());
// get services context
final Context servicesContext = (Context) jndiTemplate.lookup("services", Context.class);
// get channel-ids context
final Context channel_idsContext = (Context) jndiTemplate.lookup("users/" + userId + "/layouts/" + layoutId + "/channel-ids", Context.class);
// get channel-obj context
final Context channel_objContext = (Context) jndiTemplate.lookup("users/" + userId + "/sessions/" + sessionId + "/channel-obj", Context.class);
cic.bind("services", servicesContext);
cic.bind("channel-ids", channel_idsContext);
cic.bind("channel-obj", channel_objContext);
cic.bind("portlet-ids", new ArrayList<Object>());
return cic;
}
catch (NamingException ne) {
log.warn("Failed to create channel JNDI Context. No JNDI context will be available for inter-channel-communication.", ne);