List of usage examples for org.springframework.jndi JndiTemplate bind
public void bind(final String name, final Object object) throws NamingException
From source file:com.katsu.dwm.jndi.Loader.java
public void load(File jar, Properties prop) throws ParserConfigurationException, SAXException, IOException { String jndi = prop.getProperty(LoaderConst.MODULE_JNDI.getValue()); if (jndi != null) { InputStream is = JarUtils.getResourceAsStream(jar, jndi); if (is != null) { List<Resource> resources = ResourceParser.parse(is); JndiTemplate jndiTemplate = new JndiTemplate(); for (Resource res : resources) { Object ds = DataSourceFactory.getDataSource(res); try { jndiTemplate.bind("java:comp/env/" + res.getName(), ds); } catch (NamingException e) { logger.warn("DataSource is not registered: " + e); }// w w w . j a v a 2 s .com logger.trace("Registered JNDI DataSource java:comp/env/" + res.getName()); } } } }