tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anjib Mulepati <anji...@hotmail.com>
Subject RE: JNDI configuration with 6.0.29
Date Wed, 07 Sep 2011 13:51:30 GMT

 I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat 6.0.29.
This is giving me following error
   javax.naming.NameNotFoundException: Name dynic is not bound in this Context
      org.apache.naming.NamingContext.lookup(NamingContext.java:770)
      org.apache.naming.NamingContext.lookup(NamingContext.java:140)
      org.apache.naming.NamingContext.lookup(NamingContext.java:781)
      org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97)
      javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      org.apache.naming.NamingContext.lookup(NamingContext.java:793)
      org.apache.naming.NamingContext.lookup(NamingContext.java:140)
      org.apache.naming.NamingContext.lookup(NamingContext.java:781)
      org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      com.anjib.factory.DynICFactory.<init>(DynICFactory.java:41)
      com.anjib.actions.CommonAction.execute(CommonAction.java:42)
      org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
      org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
      org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
I ran same program with Tomcat 7.0.12 and it works fine.
Here are my configurations:
1. In META-INF/context.xml<Context antiJARLocking="true" path="/ClientDAOTest"> <Resource
name="jdbc/dynic"  auth="Container" type="oracle.jdbc.pool.OracleDataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
factory="oracle.jdbc.pool.OracleDataSourceFactory" url="jdbc:oracle:thin:@//localhost:4001/SAIDIT"
user="sfed_schema" password="sfed_schema" maxActive="20" maxIdle="10" maxWait="-1" /> </Context>
2. In WEB-INF/web.xml<resource-ref> <res-ref-name>jdbc/dynic</res-ref-name>
<res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope> </resource-ref>
3. In factory class I havepublic class DynICFactory implements JNDIInterface{
 private DataSource dataSource;
 @Override public DataSource getDataSource() { return dataSource; }
 @Override public AgencyInterface createAgencyManager() { AgencyImpl manager = new AgencyImpl();
manager.setDataSource(dataSource); return manager; }
 public DynICFactory() throws DAOException { 	DataSource ds = null; 	try { 		Context initCtx
= new InitialContext();	        Context envCtx = (Context) initCtx.lookup("java:comp/env");
        ds = (DataSource) envCtx.lookup("jdbc/dynic");        } catch (NamingException e)
{	        throw new DAOException("Tomcat JNDI setup failed", e);         } this.dataSource
= ds; }

Anjib Man Mulepati

409-225-6216


 

> Date: Wed, 7 Sep 2011 10:55:19 +0100
> From: pid@pidster.com
> To: users@tomcat.apache.org
> Subject: Re: JNDI configuration with 6.0.29
> 
> On 06/09/2011 21:11, Anjib Mulepati wrote:
> > 
> > Hi All,
> > I am trying to setup JNDI mapping for oracle JDBC Connection Pooling with Tomcat
6.0.29. This is giving me following error
> > javax.naming.NameNotFoundException: Name dynic is not bound in this Context
> > 	org.apache.naming.NamingContext.lookup(NamingContext.java:770)
> > 	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
> > 	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
> > 	org.apache.naming.NamingContext.lookup(NamingContext.java:153)
> > 	org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97)
> > 	javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
> > 	org.apache.naming.NamingContext.lookup(NamingContext.java:793)
> > 	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
> > 	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
> > 	org.apache.naming.NamingContext.lookup(NamingContext.java:153)
> > 	com.anjib.factory.DynICFactory.<init>(DynICFactory.java:41)
> > 	com.anjib.actions.CommonAction.execute(CommonAction.java:42)
> > 	org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
> > 	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
> > 	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
> > 	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
> > 	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> > 	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)I ran same program
with Tomcat 7.0.12 and it works fine. Here are my configurations:1. In META-INF/context.xml<Context
antiJARLocking="true" path="/ClientDAOTest">    <Resource name="jdbc/dynic"        
   auth="Container"            type="oracle.jdbc.pool.OracleDataSource"            driverClassName="oracle.jdbc.driver.OracleDriver"
           factory="oracle.jdbc.pool.OracleDataSourceFactory"            url="jdbc:oracle:thin:@//localhost:4001/SAIDIT"
           user="sfed_schema"            password="sfed_schema"            maxActive="20"
           maxIdle="10"            maxWait="-1" />           </Context>2. In WEB-INF/web.xml<resource-ref>
 <res-ref-name>jdbc/dynic</res-ref-name> <res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
> > 2. In factory class I havepublic class DynICFactory implements JNDIInterface{  
     private DataSource dataSource;        @Override    public DataSource getDataSource()
{        return dataSource;    }
> >     @Override    public AgencyInterface createAgencyManager() {        AgencyImpl
manager = new AgencyImpl();        manager.setDataSource(dataSource);        return manager;
   }
> >     public DynICFactory() throws DAOException {        DataSource ds = null;   
    try {            Context initCtx = new InitialContext();            Context envCtx = (Context)
initCtx.lookup("java:comp/env");            ds = (DataSource) envCtx.lookup("jdbc/dynic");
                   } catch (NamingException e) {            throw new DAOException("Tomcat
JNDI setup failed", e);        }        this.dataSource = ds;    }            }
> 
> That came out garbled.  Can you reformat it so we can read it?
> 
> 
> p
> 
> 
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message