package com.waratek.spiracle.sql.jndi;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import javax.sql.DataSource;

import org.apache.log4j.Logger;

@WebListener
public class CreateJndiConnectionPool implements ServletContextListener {
	private static final Logger logger = Logger.getLogger(CreateJndiConnectionPool.class);

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {

	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		try {
			Context ctx = new InitialContext();
			DataSource ds = (DataSource) ctx.lookup("jdbc/oracle");
			ServletContext application = arg0.getServletContext();
			application.setAttribute("jndiConnectionPool", ds);
			logger.info("Added jndi connection pool " + ds + " to application context.");
		} catch (NamingException e) {
			logger.error("JNDI reference not found.");
			e.printStackTrace();
		}
	}
}
@@ -779,16 +779,30 @@
 lookup(%22
+java:comp/env/
 jdbc/ora

Fix JNDI lookup string.