tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anjib Mulepati <anji...@hotmail.com>
Subject JNDI configuration with 6.0.29 <Reformatted>
Date Wed, 07 Sep 2011 14:08:24 GMT
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>

3. In factory class I have

	public 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;
  		}
	 }


On 9/6/2011 4:11 PM, 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;    }            }
>
>
>
> Anjib Man Mulepati
>
> 409-225-6216
>
>
>    		 	   		   		 	   		



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message