permaculture playing cards*
The moose likes Struts and the fly likes javax naming name not found exception jndi in struts2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javax naming name not found exception jndi in struts2.0" Watch "javax naming name not found exception jndi in struts2.0" New topic

javax naming name not found exception jndi in struts2.0

jaan bhavsar
Ranch Hand

Joined: Aug 23, 2008
Posts: 32
Hi to all Ranchers,
I am making connection pool with tomcat.i define necessary entry in server.xml,web.xml and made one listener class to get the connection.but i am getting error "javax naming name not found exception jndi" when i start the tomcat server.and also in my listener value of dataSourcejndi name is displayed null.

Please guide me how to get the jndidatasource name in listener .I attached three files for your reference in single file.


2)Server.xml(in tomcat)

3)Listener Class to get the jndidatasource name
i am getting the jndiname null
package util;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.sql.DataSource;

public class AppListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent sce) {

ServletContext servletContext = sce.getServletContext();
String dataSourceJndiName = servletContext.getInitParameter
Context context = new InitialContext();
DataSource dataSource = (DataSource)context.lookup

}catch(Exception e)
public void contextDestroyed(ServletContextEvent des) {



Thank you in advance
David Newton

Joined: Sep 29, 2008
Posts: 12617

You should ask in a JNDI/Tomcat-oriented forum; this has nothing to do with Struts.
jQuery in Action, 2nd edition
subject: javax naming name not found exception jndi in struts2.0
Similar Threads
Configure tomcat resource factory
Name jdbc is not bound in this Context
Pooling w/Tomcat 5 - Oracle
javax.naming.NamingException- Cannot create resource instance
Tomcat Database Connection Pooling Error