You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Anjib Mulepati <an...@hotmail.com> on 2011/09/07 16:08:24 UTC

JNDI configuration with 6.0.29

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


Re: JNDI configuration with 6.0.29

Posted by Chema <de...@gmail.com>.
>>       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)

Are you try to create a simple HttpServlet and run that code (lookup
method) directly at doGetmethod ( i mean, no struts, no factory ) ?
I'm not sure this be the problem but ...

Regards

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


RE: JNDI configuration with 6.0.29

Posted by "Propes, Barry L " <ba...@citi.com>.
And do you have an instance of the jdbc driver in more than one place?

-----Original Message-----
From: Felix Schumacher [mailto:felix.schumacher@internetallee.de]
Sent: Thursday, September 08, 2011 2:01 PM
To: Tomcat Users List
Subject: Re: JNDI configuration with 6.0.29 <Reformatted>

Am Donnerstag, den 08.09.2011, 14:49 -0400 schrieb Anjib Mulepati:
> yes after changing to
>      ds = (DataSource) envCtx.lookup("jdbc/dummy_value");
>
> i am getting
>
> javax.naming.NameNotFoundException: Name dummy_value 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)
>       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)
Ok, strange...

Do you have any other error messages, you are not showing us? :)

Where have you put your jdbc-driver for oracle?

Bye
 Felix
>
>
> On 9/8/2011 2:43 PM, Felix Schumacher wrote:
> > Am Mittwoch, den 07.09.2011, 10:22 -0500 schrieb Anjib Mulepati:
> >> Yes I am positive
> > So, your error message changes, if you change your factory code?
> >
> > Say, if you change your code like this
> >
> >    ds = (DataSource) envCtx.lookup("jdbc/no_such_name");
> >
> > Do you see a message like "NameNotFoundException: Name no_such_name
> > is not bound..."?
> >
> > Felix
> >>
> >> Anjib Man Mulepati
> >>
> >> 409-225-6216
> >>
> >>
> >>
> >>
> >>> Subject: Re: JNDI configuration with 6.0.29<Reformatted>
> >>> From: felix.schumacher@internetallee.de
> >>> Date: Wed, 7 Sep 2011 17:17:21 +0200
> >>> To: users@tomcat.apache.org
> >>>
> >>>
> >>>
> >>> Anjib Mulepati<an...@hotmail.com>  schrieb:
> >>>
> >>>> 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
> >>>  From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us?
> >>>
> >>> Bye
> >>>   Felix
> >>>> 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");
> >>>>
> >>>>                   } 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.ja
> >>>> va: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
> >>>
> >>>
> >>> ------------------------------------------------------------------
> >>> --- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>
> >>
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>



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


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


Re: JNDI configuration with 6.0.29

Posted by Felix Schumacher <fe...@internetallee.de>.
Am Donnerstag, den 08.09.2011, 14:49 -0400 schrieb Anjib Mulepati:
> yes after changing to
>      ds = (DataSource) envCtx.lookup("jdbc/dummy_value");
> 
> i am getting
> 
> javax.naming.NameNotFoundException: Name dummy_value 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)
> 	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)
Ok, strange...

Do you have any other error messages, you are not showing us? :)

Where have you put your jdbc-driver for oracle?

Bye
 Felix
> 
> 
> On 9/8/2011 2:43 PM, Felix Schumacher wrote:
> > Am Mittwoch, den 07.09.2011, 10:22 -0500 schrieb Anjib Mulepati:
> >> Yes I am positive
> > So, your error message changes, if you change your factory code?
> >
> > Say, if you change your code like this
> >
> >    ds = (DataSource) envCtx.lookup("jdbc/no_such_name");
> >
> > Do you see a message like "NameNotFoundException: Name no_such_name is
> > not bound..."?
> >
> > Felix
> >>
> >> Anjib Man Mulepati
> >>
> >> 409-225-6216
> >>
> >>
> >>
> >>
> >>> Subject: Re: JNDI configuration with 6.0.29<Reformatted>
> >>> From: felix.schumacher@internetallee.de
> >>> Date: Wed, 7 Sep 2011 17:17:21 +0200
> >>> To: users@tomcat.apache.org
> >>>
> >>>
> >>>
> >>> Anjib Mulepati<an...@hotmail.com>  schrieb:
> >>>
> >>>> 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
> >>>  From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us?
> >>>
> >>> Bye
> >>>   Felix
> >>>> 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");
> >>>> 				
> >>>> 			 } 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
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>
> >>   		 	   		
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



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


Re: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
yes after changing to
     ds = (DataSource) envCtx.lookup("jdbc/dummy_value");

i am getting

javax.naming.NameNotFoundException: Name dummy_value 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)
	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)


On 9/8/2011 2:43 PM, Felix Schumacher wrote:
> Am Mittwoch, den 07.09.2011, 10:22 -0500 schrieb Anjib Mulepati:
>> Yes I am positive
> So, your error message changes, if you change your factory code?
>
> Say, if you change your code like this
>
>    ds = (DataSource) envCtx.lookup("jdbc/no_such_name");
>
> Do you see a message like "NameNotFoundException: Name no_such_name is
> not bound..."?
>
> Felix
>>
>> Anjib Man Mulepati
>>
>> 409-225-6216
>>
>>
>>
>>
>>> Subject: Re: JNDI configuration with 6.0.29<Reformatted>
>>> From: felix.schumacher@internetallee.de
>>> Date: Wed, 7 Sep 2011 17:17:21 +0200
>>> To: users@tomcat.apache.org
>>>
>>>
>>>
>>> Anjib Mulepati<an...@hotmail.com>  schrieb:
>>>
>>>> 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
>>>  From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us?
>>>
>>> Bye
>>>   Felix
>>>> 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");
>>>> 				
>>>> 			 } 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
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>   		 	   		
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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


RE: JNDI configuration with 6.0.29

Posted by Felix Schumacher <fe...@internetallee.de>.
Am Mittwoch, den 07.09.2011, 10:22 -0500 schrieb Anjib Mulepati:
> Yes I am positive
So, your error message changes, if you change your factory code?

Say, if you change your code like this

  ds = (DataSource) envCtx.lookup("jdbc/no_such_name");

Do you see a message like "NameNotFoundException: Name no_such_name is
not bound..."?

Felix
> 
> 
> Anjib Man Mulepati
> 
> 409-225-6216
> 
> 
>  
> 
> > Subject: Re: JNDI configuration with 6.0.29 <Reformatted>
> > From: felix.schumacher@internetallee.de
> > Date: Wed, 7 Sep 2011 17:17:21 +0200
> > To: users@tomcat.apache.org
> > 
> > 
> > 
> > Anjib Mulepati <an...@hotmail.com> schrieb:
> > 
> > >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
> > From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us?
> > 
> > Bye
> >  Felix
> > >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");
> > >				  
> > >			 } 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
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
>  		 	   		  



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


Re: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
i change to
<Resource name="jdbc/dynic"
             auth="Container"
             type="javax.sql.DataSource"
             driverClassName="oracle.jdbc.driver.OracleDriver"
             url="jdbc:oracle:thin:@//localhost:4001/SAIDIT"
             user="sfed_schema"
             password="sfed_schema"
             maxActive="20"
             maxIdle="10"
             maxWait="-1" />

and still same problem.
On 9/7/2011 12:31 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Anjib,
>
> On 9/7/2011 12:21 PM, Anjib Mulepati wrote:
>> I did checked the XML file and it looks correct to me. Following is
>> the content:
>>
>> <?xml version="1.0" encoding="UTF-8"?>  <Context
>> antiJARLocking="true" docBase="C:\Users\amulepati\My
>> Projects\ClientDAOTest\build\web" path="/ClientDAOTest">
> It probably has no bearing on this particular problem, but the "path"
> attribute is illegal here.
>
>> <Resource auth="Container"
>> driverClassName="oracle.jdbc.driver.OracleDriver"
>> factory="oracle.jdbc.pool.OracleDataSourceFactory"
> Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to
> use it's own DataSourceFactory.
>
>> maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/dynic"
> I'm curious why the lookup fails with the message about "dynic" and
> not, as Felix asks, "jdbc/dynic".
>
>> password="sfed_schema" type="oracle.jdbc.pool.OracleDataSource"
>> url="jdbc:oracle:thin:@//localhost:4001/SAIDIT"
>> user="sfed_schema"/>
> I have "username" as the attribute in my<Resource>, but this might be
> the way you have to configure Oracle's factory. Here's what I've got
> in my configuration:
>
>     <Resource name="jdbc/db"
>      description="db"
>          auth="Container"
>          type="javax.sql.DataSource"
>          maxActive="1"
>          maxIdle="1"
>          maxWait="10000"
>          url="jdbc:[url]"
>          username="scott"
>          password="tiger"
>          driverClassName="com.mysql.jdbc.Driver"
>          removeAbandoned="true"
>          removeAbandonedTimeout="30"
>          logAbandoned="true"
>          testOnBorrow="true"
>          validationQuery="/* ping */ SELECT 1"
>      />
>
> (That "validationQuery" is a short-cut for MySQL connection testing.
> Feel free to use something like "SELECT 1 FROM DUAL" when using Oracle).
>
>> Same config work for Tomcat 7 so I am wondering is there any thing
>> I have to different/extra in Tomcat 6
> The configuration should be identical to Tomcat 6.
>
> Do you see any messages in your logs during webapp startup?
>
> I wrote a JSP-based JNDI navigator a while back but I can't seem to
> find it. Maybe I'll whip one up so you can look-around the JNDI tree
> to see if your DataSource is just misplaced. I'm sure you can write
> one yourself fairly easily, too.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk5nnFYACgkQ9CaO5/Lv0PAFrwCfcrpNdl8EiBvtsSc2ju5Lp7LF
> MzsAn35+pyrAivj6TtHBMWj6G6rL5+UN
> =sBGp
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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


Re: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
Tomcat log says

SEVERE: Servlet.service() for servlet jsp threw exception
javax.naming.NameNotFoundException: Name dynic is not bound in this Context
     at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
     at 
org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97)
     at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
     at org.apache.jsp.test_jsp._jspService(test_jsp.java:77)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
     at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
     at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
     at java.lang.Thread.run(Thread.java:662)

On 9/7/2011 5:40 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Anjib,
>
> On 9/7/2011 12:57 PM, Anjib Mulepati wrote:
>>>> I did checked the XML file and it looks correct to me.
>>>> Following is the content:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>   <Context
>>>> antiJARLocking="true" docBase="C:\Users\amulepati\My
>>>> Projects\ClientDAOTest\build\web" path="/ClientDAOTest">
>>> It probably has no bearing on this particular problem, but the
>>> "path" attribute is illegal here.
>> Isn't that context path of web applciation is specified with the
>> "path" attribute.
>> http://tomcat.apache.org/tomcat-4.0-doc/config/context.html
> You're not using Tomcat 4.0, you're using Tomcat 6.0. Look at the
> documentation that is appropriate for your version of Tomcat: the
> "path" attribute is only appropriate when the<Context>  is defined in
> server.xml, which is highly discouraged.
>
> The name of the XML file (when deployed) or the name of the WAR file
> (or exploded WAR directory structure) will dictate the context path
> and so it need not (and should not) be specified in context.xml.
>
>>>> <Resource auth="Container"
>>>> driverClassName="oracle.jdbc.driver.OracleDriver"
>>>> factory="oracle.jdbc.pool.OracleDataSourceFactory"
>>> Do you need to use Oracle's DataSourceFactory? If not, allow
>>> Tomcat to use it's own DataSourceFactory.
>> To be safe can you tell me what change I have to do for that.
> Simply remove the "factory" attribute altogether. Tomcat knows what
> it's default is.
>
>>>> maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/dynic"
>>> I'm curious why the lookup fails with the message about "dynic"
>>> and not, as Felix asks, "jdbc/dynic".
>> I am wondering on same. Is there any way to debug this.
> Tomcat's logging usually provides some indication of a failure, but
> you haven't mentioned anything about log entries. Can you see if there
> are any log messages?
>
> Finally, try changing the "user" attribute to "username".
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk5n5MwACgkQ9CaO5/Lv0PCjoACfcadA/2p8u9VT7EdTgHTrF6Qo
> S9MAn1KxzCBXRPCzmsiYkgWI0RZl0UtB
> =9Gr4
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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


Re: JNDI configuration with 6.0.29

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anjib,

On 9/8/2011 5:51 PM, Anjib Mulepati wrote:
> 
> when i click  on java:/comp  it gave  error
> 
> Error: Cannot create resource instance
> 
> javax.naming.NamingException: Cannot create resource

Then don't click on that. Click on something else under
"java:comp/env". If you have nothing under there (such as "jdbc") then
you really do not have your <Resource> configured properly.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5qhdUACgkQ9CaO5/Lv0PCwPgCfeWgYcBKZT8CIZqlBlrk2Tijo
KI8An3pILatd2mNqb97XUgIVGHnml4P1
=wsa8
-----END PGP SIGNATURE-----

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


Re: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
when i click  on java:/comp 
<http://localhost:8080/ClientDAOTest/newjsp.jsp?path=java:/comp> it gave 
error

Error: Cannot create resource instance

                 javax.naming.NamingException: Cannot create resource instance
	at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
	at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)
	at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
	at org.apache.jsp.newjsp_jsp._jspService(newjsp_jsp.java:106)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:662)

    When I click onjdbc  <http://localhost:8080/ClientDAOTest/newjsp.jsp?path=java:comp/env/jdbc>

it give error

Error: Name jdbc is not bound in this Context

                 javax.naming.NameNotFoundException: Name jdbc is not 
bound in this Context
     at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
     at 
org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97)
     at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
     at 
org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)
     at 
org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
     at org.apache.jsp.newjsp_jsp._jspService(newjsp_jsp.java:106)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
     at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
     at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
     at java.lang.Thread.run(Thread.java:662)





On 9/8/2011 5:11 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Anjib,
>
> On 9/8/2011 4:51 PM, Anjib Mulepati wrote:
>> DataSource ds = null; try { 40.           Context initCtx = new
>> InitialContext(); 41.            Context envCtx = (Context)
>> initCtx.lookup("java:comp/env"); 42.           ds = (DataSource)
>> envCtx.lookup("jdbc/dynic");
> Odd to use a local variable for this, but I guess you could do that.
>
> I've seen "java:comp/env" and "java:/comp/env", but both seem to work.
>
> Try running this JSP. It's a bit fragile, but it should get the job done.
>
> - -chris
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <%@page pageEncoding="UTF-8"
>     session="false"
>     language="Java"
>     import="
>      javax.naming.InitialContext,
>      javax.naming.Binding,
>      javax.naming.Context,
>      javax.naming.NamingEnumeration,
>      javax.naming.NamingException
>     "
> %>
> <%
>    String path = "java:/comp/env";
>
>    String pathParam = request.getParameter("path");
>    if(null != pathParam&&  !"".equals(pathParam.trim()))
>      path = pathParam.trim();
>
>    int pos = path.lastIndexOf('/');
>    String parent = pos>  0 ? path.substring(0, pos) : "java:comp/env";
> %>
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
>    <title>JNDI Browser:<%= path %></title>
> </head>
> <body>
>    <h1>JNDI Browser:<%= path %></h1>
>
>    <p><a href="?path=<%= parent %>"><%= parent %></a></p>
> <%
>    InitialContext ctx = null;
>    NamingEnumeration e = null;
>    try
>    {
>      ctx = new InitialContext();
>      e = ctx.listBindings(path);
>
>      if(e.hasMoreElements())
>      {
> %>
>    <ul>
> <%
>        while(e.hasMoreElements())
>        {
>          Binding b = (Binding)e.next();
> %>
>      <li>
> <%
>          if(b.getObject() instanceof Context)
>          {
> %>
>            <a href="?path=<%= path %>/<%= b.getName() %>"><%=
> b.getName() %></a>
> <%
>          }
>          else
>          {
> %>
>             <%= b.getName() %>  (<%= b.getClassName() %>)
> <%
>          }
> %>
>      </li>
> <%
>        }
> %>
>    </ul>
> <%
>      }
>      else
>      {
> %>
>    <p>JNDI context is empty</p>
> <%
>      }
>    }
>    catch (NamingException ne)
>    {
> %>
>    <p>Error:<%= ne.getMessage() %><pre>
>    <%
>      java.io.PrintWriter myout = new java.io.PrintWriter(out);
>      ne.printStackTrace(myout);
>      myout.flush();
>    %>
>    </pre></p>
> <%
>    }
>    finally
>    {
>      if(null != e) try { e.close(); } catch (NamingException ne)
>        { %><p><%= ne.getMessage() %></p><% }
>
>      if(null != ctx) try { ctx.close(); } catch (NamingException ne)
>        { %><p><%= ne.getMessage() %></p><% }
>    }//foo
> %>
> </body>
> </html>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk5pL3gACgkQ9CaO5/Lv0PBLAQCglRlAcKBZa5Gtrg494FfcvA2c
> /hIAoIu0fj/5ejz3+C3Pk/S8i1PeQG50
> =F0ZW
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


RE: JNDI configuration with 6.0.29

Posted by "Propes, Barry L " <ba...@citi.com>.
I had something similar but referenced the Connection object right with it, essentially.

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
// Look up our data source
DataSource ds = (DataSource) envCtx.lookup("jdbc/myoracle");
// Allocate and use a connection from the pool
Connection connection = ds.getConnection();

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net]
Sent: Thursday, September 08, 2011 4:11 PM
To: Tomcat Users List
Subject: Re: JNDI configuration with 6.0.29

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anjib,

On 9/8/2011 4:51 PM, Anjib Mulepati wrote:
> DataSource ds = null; try { 40.           Context initCtx = new
> InitialContext(); 41.            Context envCtx = (Context)
> initCtx.lookup("java:comp/env"); 42.           ds = (DataSource)
> envCtx.lookup("jdbc/dynic");

Odd to use a local variable for this, but I guess you could do that.

I've seen "java:comp/env" and "java:/comp/env", but both seem to work.

Try running this JSP. It's a bit fragile, but it should get the job done.

- -chris

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@page pageEncoding="UTF-8"
   session="false"
   language="Java"
   import="
    javax.naming.InitialContext,
    javax.naming.Binding,
    javax.naming.Context,
    javax.naming.NamingEnumeration,
    javax.naming.NamingException
   "
%>
<%
  String path = "java:/comp/env";

  String pathParam = request.getParameter("path");
  if(null != pathParam && !"".equals(pathParam.trim()))
    path = pathParam.trim();

  int pos = path.lastIndexOf('/');
  String parent = pos > 0 ? path.substring(0, pos) : "java:comp/env"; %> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>
  <title>JNDI Browser: <%= path %></title> </head> <body>
  <h1>JNDI Browser: <%= path %></h1>

  <p><a href="?path=<%= parent %>"><%= parent %></a></p> <%
  InitialContext ctx = null;
  NamingEnumeration e = null;
  try
  {
    ctx = new InitialContext();
    e = ctx.listBindings(path);

    if(e.hasMoreElements())
    {
%>
  <ul>
<%
      while(e.hasMoreElements())
      {
        Binding b = (Binding)e.next();
%>
    <li>
<%
        if(b.getObject() instanceof Context)
        {
%>
          <a href="?path=<%= path %>/<%= b.getName() %>"><%=
b.getName() %></a>
<%
        }
        else
        {
%>
           <%= b.getName() %> (<%= b.getClassName() %>) <%
        }
%>
    </li>
<%
      }
%>
  </ul>
<%
    }
    else
    {
%>
  <p>JNDI context is empty</p>
<%
    }
  }
  catch (NamingException ne)
  {
%>
  <p>Error: <%= ne.getMessage() %><pre>
  <%
    java.io.PrintWriter myout = new java.io.PrintWriter(out);
    ne.printStackTrace(myout);
    myout.flush();
  %>
  </pre></p>
<%
  }
  finally
  {
    if(null != e) try { e.close(); } catch (NamingException ne)
      { %><p><%= ne.getMessage() %></p><% }

    if(null != ctx) try { ctx.close(); } catch (NamingException ne)
      { %><p><%= ne.getMessage() %></p><% }
  }//foo
%>
</body>
</html>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5pL3gACgkQ9CaO5/Lv0PBLAQCglRlAcKBZa5Gtrg494FfcvA2c
/hIAoIu0fj/5ejz3+C3Pk/S8i1PeQG50
=F0ZW
-----END PGP SIGNATURE-----

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


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


Re: JNDI configuration with 6.0.29

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anjib,

On 9/8/2011 4:51 PM, Anjib Mulepati wrote:
> DataSource ds = null; try { 40.           Context initCtx = new
> InitialContext(); 41.            Context envCtx = (Context)
> initCtx.lookup("java:comp/env"); 42.           ds = (DataSource)
> envCtx.lookup("jdbc/dynic");

Odd to use a local variable for this, but I guess you could do that.

I've seen "java:comp/env" and "java:/comp/env", but both seem to work.

Try running this JSP. It's a bit fragile, but it should get the job done.

- -chris

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@page pageEncoding="UTF-8"
   session="false"
   language="Java"
   import="
    javax.naming.InitialContext,
    javax.naming.Binding,
    javax.naming.Context,
    javax.naming.NamingEnumeration,
    javax.naming.NamingException
   "
%>
<%
  String path = "java:/comp/env";

  String pathParam = request.getParameter("path");
  if(null != pathParam && !"".equals(pathParam.trim()))
    path = pathParam.trim();

  int pos = path.lastIndexOf('/');
  String parent = pos > 0 ? path.substring(0, pos) : "java:comp/env";
%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>JNDI Browser: <%= path %></title>
</head>
<body>
  <h1>JNDI Browser: <%= path %></h1>

  <p><a href="?path=<%= parent %>"><%= parent %></a></p>
<%
  InitialContext ctx = null;
  NamingEnumeration e = null;
  try
  {
    ctx = new InitialContext();
    e = ctx.listBindings(path);

    if(e.hasMoreElements())
    {
%>
  <ul>
<%
      while(e.hasMoreElements())
      {
        Binding b = (Binding)e.next();
%>
    <li>
<%
        if(b.getObject() instanceof Context)
        {
%>
          <a href="?path=<%= path %>/<%= b.getName() %>"><%=
b.getName() %></a>
<%
        }
        else
        {
%>
           <%= b.getName() %> (<%= b.getClassName() %>)
<%
        }
%>
    </li>
<%
      }
%>
  </ul>
<%
    }
    else
    {
%>
  <p>JNDI context is empty</p>
<%
    }
  }
  catch (NamingException ne)
  {
%>
  <p>Error: <%= ne.getMessage() %><pre>
  <%
    java.io.PrintWriter myout = new java.io.PrintWriter(out);
    ne.printStackTrace(myout);
    myout.flush();
  %>
  </pre></p>
<%
  }
  finally
  {
    if(null != e) try { e.close(); } catch (NamingException ne)
      { %><p><%= ne.getMessage() %></p><% }

    if(null != ctx) try { ctx.close(); } catch (NamingException ne)
      { %><p><%= ne.getMessage() %></p><% }
  }//foo
%>
</body>
</html>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5pL3gACgkQ9CaO5/Lv0PBLAQCglRlAcKBZa5Gtrg494FfcvA2c
/hIAoIu0fj/5ejz3+C3Pk/S8i1PeQG50
=F0ZW
-----END PGP SIGNATURE-----

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


Re: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
1. Changed to "ojdbc6" same problem.
2. I didn't change any config
3.

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 {
  40.           Context initCtx = new InitialContext();
41.            Context envCtx = (Context) initCtx.lookup("java:comp/env");
  42.           ds = (DataSource) envCtx.lookup("jdbc/dynic");
    43.
  44.       } catch (NamingException e) {
             throw new DAOException("Tomcat JNDI setup failed", e);
         }
         this.dataSource = ds;
     }

     @Override
     public GroupInterface createGroupManager() {
         GroupImpl manager = new GroupImpl();
         manager.setDataSource(dataSource);
         return manager;
     }
}
On 9/8/2011 4:33 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> njib,
>
> On 9/8/2011 3:54 PM, Anjib Mulepati wrote:
>> 1. I have only one instance of jar file "classes12.jar" under lib
>> folder of tomcat.
> Wow... classes12? I remember that from back in the year 2000. Are you
> sure it isn't the old ZIP file they used to ship?
>
>> 2. There is no other error I can see in the log. But error message
>> do change to following
>>
>> Sep 8, 2011 3:50:45 PM
>> org.apache.catalina.core.StandardWrapperValve invoke SEVERE:
>> Servlet.service() for servlet action threw exception
>> javax.naming.NameNotFoundException: Name jdbc is not bound in this
>> Context
> So, the error message changed slightly (s/dynic/jdbc/). What
> configuration did you change?
>
>> at com.anjib.factory.DynICFactory.<init>(DynICFactory.java:41)
> Just curious about this. Can you re-post your code for
> DynICFactory.<init>  including the line numbers?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk5pJo0ACgkQ9CaO5/Lv0PCrfQCdEz2iGOfym6Cqh3jQ67NZ/gCG
> Dt4AmwVdee4TQ4QN4Te3t6alzBneG78B
> =zoTV
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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


Re: JNDI configuration with 6.0.29

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

njib,

On 9/8/2011 3:54 PM, Anjib Mulepati wrote:
> 1. I have only one instance of jar file "classes12.jar" under lib
> folder of tomcat.

Wow... classes12? I remember that from back in the year 2000. Are you
sure it isn't the old ZIP file they used to ship?

> 2. There is no other error I can see in the log. But error message
> do change to following
> 
> Sep 8, 2011 3:50:45 PM
> org.apache.catalina.core.StandardWrapperValve invoke SEVERE:
> Servlet.service() for servlet action threw exception 
> javax.naming.NameNotFoundException: Name jdbc is not bound in this
> Context

So, the error message changed slightly (s/dynic/jdbc/). What
configuration did you change?

> at com.anjib.factory.DynICFactory.<init>(DynICFactory.java:41)

Just curious about this. Can you re-post your code for
DynICFactory.<init> including the line numbers?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5pJo0ACgkQ9CaO5/Lv0PCrfQCdEz2iGOfym6Cqh3jQ67NZ/gCG
Dt4AmwVdee4TQ4QN4Te3t6alzBneG78B
=zoTV
-----END PGP SIGNATURE-----

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


RE: ODBC jar files

Posted by "Propes, Barry L " <ba...@citi.com>.
Yikes!

I'll fix that right away.

Thanks, Chris!

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net]
Sent: Tuesday, October 25, 2011 9:49 AM
To: Tomcat Users List
Subject: Re: ODBC jar files

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry,

On 10/25/2011 10:04 AM, Propes, Barry L wrote:
> I did not take it out, but simply added the new ojdbc6.jar, to the
> lib, which from the sounds of things sounds like a bad idea (to add
> and have both in there).

Yes, it is a bad idea. Classes will be loaded arbitrarily from one JAR or the other (but at least consistently, one of them should trump the
other) and you may get an "updated" class that conflicts with an old class. If you've ever been in "XML hell", it's the same thing: fighting libraries.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6mzEQACgkQ9CaO5/Lv0PDCBQCgsrB6FrREV9q5t5fdwZDgXlz5
NqEAn0ieun/8hir+tiysgN/LkQXZsuSv
=Thny
-----END PGP SIGNATURE-----

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


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


Re: ODBC jar files

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry,

On 10/25/2011 10:04 AM, Propes, Barry L wrote:
> I did not take it out, but simply added the new ojdbc6.jar, to the 
> lib, which from the sounds of things sounds like a bad idea (to
> add and have both in there).

Yes, it is a bad idea. Classes will be loaded arbitrarily from one JAR
or the other (but at least consistently, one of them should trump the
other) and you may get an "updated" class that conflicts with an old
class. If you've ever been in "XML hell", it's the same thing: fighting
libraries.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6mzEQACgkQ9CaO5/Lv0PDCBQCgsrB6FrREV9q5t5fdwZDgXlz5
NqEAn0ieun/8hir+tiysgN/LkQXZsuSv
=Thny
-----END PGP SIGNATURE-----

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


RE: ODBC jar files

Posted by "Propes, Barry L " <ba...@citi.com>.
Thanks a bunch, Jeff!

This helps. I just downloaded ojdbc6.jar, but have been running  ojdbc14.jar, and it's still in the lib folder.

I did not take it out, but simply added the new ojdbc6.jar, to the lib, which from the sounds of things sounds like a bad idea (to add and have both in there).

I am running Tomcat 6.0.29. I'll try removing the other older ojdbc jar file and replace it with the newer one -  ojdbc6.jar.

I will go get the other documentation, too, Jeff!

Thanks for the tips!

Barry



-----Original Message-----
From: Jeffrey Janner [mailto:Jeffrey.Janner@PolyDyne.com]
Sent: Tuesday, October 25, 2011 8:52 AM
To: 'Tomcat Users List'
Subject: RE: ODBC jar files

Barry -

I run an Oracle mixed environment and I can assure you that you will run into problems running ojdbc14.jar and connecting to your 11g database.  In particular, you will see some "odd" errors related to bind peek on the server side - but that is supposedly fixed in 11.2.0.2.  I can't say for sure as I haven't been able to schedule an upgrade, yet.  If you want to talk to 11g, you really should use the 11.2.0.2 ojdbc jar file.  You can get that directly from the Oracle website.

It should be mostly backwards compatible for connecting to 10g, but there are a few "improvements" that might come back to bite you.  In particular, they have added additional mappings to handle the Native Language string columns (NCHAR, NVARCHAR, etc.).  Before switching to that jar in your legacy app, you need to insure that it won't be a problem, or you may need to make some quick changes to the code.

Also, according to Oracle, make sure you grab the ojdbc file that matches the Java version you are running.  If your Tomcat runs under Java 5, you need the ojdbc5.jar.  The ojdbc6.jar is only for using with Java 6.  They are the same code, but compiled for those java versions, and I assume optimized for them.

If you don't know what version of the ojdbc file you have, you can always look it up.  Using your favorite unzip tool, extract the MANIFEST.MF file from the META-INF directory of the ojdbcx.jar file.  It's a simple text file and contains the release number of the jar file.

And while you're on the Oracle JDBC website, download the documentation that goes along with it.  Read it thoroughly and see what other changes they've made that might be useful and/or detrimental to your implementation.

Jeff

> -----Original Message-----
> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> Sent: Monday, October 24, 2011 3:36 PM
> To: Tomcat Users List
> Subject: RE: ODBC jar files
>
> Ok, thanks for that explanation. I'll test putting one in the WEB-
> INF/lib and see if I can connect to it that way. If so, I'll see where
> I need to go from there.
>
>
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Sent: Thursday, October 20, 2011 4:14 PM
> To: Tomcat Users List
> Subject: RE: ODBC jar files
>
> > From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> > Subject: RE: ODBC jar files
>
> > I had web app A with a context file in its META-INF directory and
> > web app B with a (different) context file in its META-INF directory.
>
> That's not related to the classloader being used here.  There's a
> separate one for Tomcat's lib directory, and that's the only one that
> sees the jars in that location.  You can put a JDBC jar in
> WEB-INF/lib, but then the webapp has to do its own DB connection pooling.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
> PROPRIETARY MATERIAL and is thus for use only by the intended
> recipient. If you received this in error, please contact the sender
> and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

__________________________________________________________________________

Confidentiality Notice:  This Transmission (including any attachments) may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.

If you have received this transmission in error, please immediately reply to the sender or telephone (512) 343-9100 and delete this transmission from your system.


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


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


RE: ODBC jar files

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
Barry -

I run an Oracle mixed environment and I can assure you that you will run into problems running ojdbc14.jar and connecting to your 11g database.  In particular, you will see some "odd" errors related to bind peek on the server side - but that is supposedly fixed in 11.2.0.2.  I can't say for sure as I haven't been able to schedule an upgrade, yet.  If you want to talk to 11g, you really should use the 11.2.0.2 ojdbc jar file.  You can get that directly from the Oracle website.

It should be mostly backwards compatible for connecting to 10g, but there are a few "improvements" that might come back to bite you.  In particular, they have added additional mappings to handle the Native Language string columns (NCHAR, NVARCHAR, etc.).  Before switching to that jar in your legacy app, you need to insure that it won't be a problem, or you may need to make some quick changes to the code.

Also, according to Oracle, make sure you grab the ojdbc file that matches the Java version you are running.  If your Tomcat runs under Java 5, you need the ojdbc5.jar.  The ojdbc6.jar is only for using with Java 6.  They are the same code, but compiled for those java versions, and I assume optimized for them. 

If you don't know what version of the ojdbc file you have, you can always look it up.  Using your favorite unzip tool, extract the MANIFEST.MF file from the META-INF directory of the ojdbcx.jar file.  It's a simple text file and contains the release number of the jar file.

And while you're on the Oracle JDBC website, download the documentation that goes along with it.  Read it thoroughly and see what other changes they've made that might be useful and/or detrimental to your implementation.

Jeff

> -----Original Message-----
> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> Sent: Monday, October 24, 2011 3:36 PM
> To: Tomcat Users List
> Subject: RE: ODBC jar files
> 
> Ok, thanks for that explanation. I'll test putting one in the WEB-
> INF/lib and see if I can connect to it that way. If so, I'll see where
> I need to go from there.
> 
> 
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Sent: Thursday, October 20, 2011 4:14 PM
> To: Tomcat Users List
> Subject: RE: ODBC jar files
> 
> > From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> > Subject: RE: ODBC jar files
> 
> > I had web app A with a context file in its META-INF directory and web
> > app B with a (different) context file in its META-INF directory.
> 
> That's not related to the classloader being used here.  There's a
> separate one for Tomcat's lib directory, and that's the only one that
> sees the jars in that location.  You can put a JDBC jar in WEB-INF/lib,
> but then the webapp has to do its own DB connection pooling.
> 
> - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
> PROPRIETARY MATERIAL and is thus for use only by the intended
> recipient. If you received this in error, please contact the sender and
> delete the e-mail and its attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

__________________________________________________________________________

Confidentiality Notice:  This Transmission (including any attachments) may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.  

If you have received this transmission in error, please immediately reply to the sender or telephone (512) 343-9100 and delete this transmission from your system.


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


RE: ODBC jar files

Posted by "Propes, Barry L " <ba...@citi.com>.
Ok, thanks for that explanation. I'll test putting one in the WEB-INF/lib and see if I can connect to it that way. If so, I'll see where I need to go from there.


-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
Sent: Thursday, October 20, 2011 4:14 PM
To: Tomcat Users List
Subject: RE: ODBC jar files

> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> Subject: RE: ODBC jar files

> I had web app A with a context file in its META-INF directory and web
> app B with a (different) context file in its META-INF directory.

That's not related to the classloader being used here.  There's a separate one for Tomcat's lib directory, and that's the only one that sees the jars in that location.  You can put a JDBC jar in WEB-INF/lib, but then the webapp has to do its own DB connection pooling.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


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


RE: ODBC jar files

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Propes, Barry L [mailto:barry.l.propes@citi.com] 
> Subject: RE: ODBC jar files

> I had web app A with a context file in its META-INF directory and 
> web app B with a (different) context file in its META-INF directory.

That's not related to the classloader being used here.  There's a separate one for Tomcat's lib directory, and that's the only one that sees the jars in that location.  You can put a JDBC jar in WEB-INF/lib, but then the webapp has to do its own DB connection pooling.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


RE: ODBC jar files

Posted by "Propes, Barry L " <ba...@citi.com>.
I had kind of thought that might be the case, but wasn't sure.

I had web app A with a context file in its META-INF directory and  web app B with a (different) context file in its META-INF directory.

But just because the jars have different names, I suppose doesn't' even mean the package path is different, let alone the class name.

I'll check those very carefully.

Thanks!

-----Original Message-----
From: Ashish Kulkarni [mailto:ashish.kulkarni13@gmail.com]
Sent: Thursday, October 20, 2011 2:07 PM
To: Tomcat Users List
Subject: Re: ODBC jar files

If there are common classes it will be very hard to tell which one will be loaded by class loader

check this document,
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html



On Thu, Oct 20, 2011 at 3:00 PM, Propes, Barry L <ba...@citi.com>wrote:

> Sorry for any confusion there - I meant tomcat/lib, not WEB-INF/lib.
>
> Ok, I imagine that is a problem  then. I haven't perused both jars,
> but I imagine there's some redundancy in there!
>
> Thanks.
>
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Sent: Thursday, October 20, 2011 12:46 PM
> To: Tomcat Users List
> Subject: RE: ODBC jar files
>
> > From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> > Subject: ODBC jar files
>
> > Will it hurt to have two different odbc jar files in the lib folder?
>
> Which lib folder are you referring to?  Tomcat's lib folder, or
> WEB-INF/lib of the webapp?
>
> If any class names are common to both jars, you *will* run into trouble.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
> PROPRIETARY MATERIAL and is thus for use only by the intended
> recipient. If you received this in error, please contact the sender
> and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


--
Ashish
www.ayurwellness.com
www.mysoftwareneeds.com

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


Re: ODBC jar files

Posted by Ashish Kulkarni <as...@gmail.com>.
If there are common classes it will be very hard to tell which one will be
loaded by class loader

check this document,
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html



On Thu, Oct 20, 2011 at 3:00 PM, Propes, Barry L <ba...@citi.com>wrote:

> Sorry for any confusion there - I meant tomcat/lib, not WEB-INF/lib.
>
> Ok, I imagine that is a problem  then. I haven't perused both jars, but I
> imagine there's some redundancy in there!
>
> Thanks.
>
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Sent: Thursday, October 20, 2011 12:46 PM
> To: Tomcat Users List
> Subject: RE: ODBC jar files
>
> > From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> > Subject: ODBC jar files
>
> > Will it hurt to have two different odbc jar files in the lib folder?
>
> Which lib folder are you referring to?  Tomcat's lib folder, or WEB-INF/lib
> of the webapp?
>
> If any class names are common to both jars, you *will* run into trouble.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Ashish
www.ayurwellness.com
www.mysoftwareneeds.com

RE: ODBC jar files

Posted by "Propes, Barry L " <ba...@citi.com>.
Sorry for any confusion there - I meant tomcat/lib, not WEB-INF/lib.

Ok, I imagine that is a problem  then. I haven't perused both jars, but I imagine there's some redundancy in there!

Thanks.

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
Sent: Thursday, October 20, 2011 12:46 PM
To: Tomcat Users List
Subject: RE: ODBC jar files

> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> Subject: ODBC jar files

> Will it hurt to have two different odbc jar files in the lib folder?

Which lib folder are you referring to?  Tomcat's lib folder, or WEB-INF/lib of the webapp?

If any class names are common to both jars, you *will* run into trouble.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


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


RE: ODBC jar files

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Propes, Barry L [mailto:barry.l.propes@citi.com] 
> Subject: ODBC jar files

> Will it hurt to have two different odbc jar files in the 
> lib folder?

Which lib folder are you referring to?  Tomcat's lib folder, or WEB-INF/lib of the webapp?

If any class names are common to both jars, you *will* run into trouble.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


ODBC jar files

Posted by "Propes, Barry L " <ba...@citi.com>.
Question. Will it hurt to have two different odbc jar files in the lib folder?

I've been connecting to a production server on Oracle10g for some time, and have had my context.xml file in the META-INF directory of one web app configured to hit this Oracle server.

Our group just got a new development server on Oracle11g, and while I can connect to it via Toad or SQL Plus (thereby assuring the tnsnames file is properly configured) I cannot connect at all from the web app in Tomcat.

I've been using the drivers in the ojdbc14_g.jar file for some time but I think I may need ojdbc6.jar for the new Oracle server. I wasn't sure if these two would conflict or not.

FWIW, I'm using:
Tomcat Version 6.0.26
JDK 1.6.0_18
Win XP is my OS for the test machine.

The above mentioned .jar files. I just added the second one, ojdbc6.jar, then deleted the work folder contents and restarted the web app.

My context.xml file is configured in the following manner:

----------
<Context>
  <Resource
    auth="Container"
    description="changectrlappdev"
    name="jdbc/myoracledev"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    username="usernm"
    password="password"
    url="jdbc:oracle:thin:@croesm6734:2504:LANDMVJ"
    maxIdle="30"
    maxWait="10000"
    maxActive="10"
    testOnBorrow="true"
    timeBetweenEvictionRunsMillis="-1"
    minEvictableIdleTimeMillis="28800"
    poolPreparedStatements="true"
    removeAbandoned="true"
    removeAbandonedTimeout="300"
    logAbandoned="false"/>


    <Realm className="org.apache.catalina.realm.DataSourceRealm"
    localDataSource="true"
       dataSourceName="jdbc/myoracledev"
       userTable="users" userNameCol="user_name" userCredCol="user_pass"
   userRoleTable="user_roles" roleNameCol="role_name"/>    <!--using -->

</Context>
------------
I've also tried the following:
----------
<Context>
  <Resource
    auth="Container"
    description="changectrlappdev"
    name="jdbc/myoracledev"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    username="usernm"
    password="password"
    url="jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC )(KEY = LANDMVJ))
    (ADDRESS = (PROTOCOL = TCP )(HOST = croesm6734.specserver.net)(PORT = 2504)))
   (CONNECT_DATA =  (SID = OPSDEV)  (SERVICE_NAME = LANDMVJ)"
    maxIdle="30"
    maxWait="10000"
    maxActive="10"
    testOnBorrow="true"
    timeBetweenEvictionRunsMillis="-1"
    minEvictableIdleTimeMillis="28800"
    poolPreparedStatements="true"
    removeAbandoned="true"
    removeAbandonedTimeout="300"
    logAbandoned="false"/>

    <Realm className="org.apache.catalina.realm.DataSourceRealm"
    localDataSource="true"
       dataSourceName="jdbc/myoracledev"
       userTable="users" userNameCol="user_name" userCredCol="user_pass"
   userRoleTable="user_roles" roleNameCol="role_name"/>

</Context>
--------------------------
with the same error message getting logged.

SEVERE: Servlet.service() for servlet jsp threw exception
java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=185599744)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)


I feel this is mostly a driver error, but related to Tomcat in terms of the way the jar files are housed in the lib directory and perhaps if one set of driver classes takes precedent over another?

I really wasn't sure if those two jar files would conflict and cause issues.

If anyone can enlighten me on this it would be appreciated!

Thanks,

Barry

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


Re: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
1. I have only one instance of jar file "classes12.jar" under lib folder 
of tomcat.
2. There is no other error I can see in the log. But error message do 
change to following

Sep 8, 2011 3:50:45 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
     at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
     at 
org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97)
     at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
     at com.anjib.factory.DynICFactory.<init>(DynICFactory.java:41)
     at com.anjib.actions.CommonAction.execute(CommonAction.java:42)
     at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
     at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
     at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
     at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
     at java.lang.Thread.run(Thread.java:662)



On 9/7/2011 5:40 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Anjib,
>
> On 9/7/2011 12:57 PM, Anjib Mulepati wrote:
>>>> I did checked the XML file and it looks correct to me.
>>>> Following is the content:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>   <Context
>>>> antiJARLocking="true" docBase="C:\Users\amulepati\My
>>>> Projects\ClientDAOTest\build\web" path="/ClientDAOTest">
>>> It probably has no bearing on this particular problem, but the
>>> "path" attribute is illegal here.
>> Isn't that context path of web applciation is specified with the
>> "path" attribute.
>> http://tomcat.apache.org/tomcat-4.0-doc/config/context.html
> You're not using Tomcat 4.0, you're using Tomcat 6.0. Look at the
> documentation that is appropriate for your version of Tomcat: the
> "path" attribute is only appropriate when the<Context>  is defined in
> server.xml, which is highly discouraged.
>
> The name of the XML file (when deployed) or the name of the WAR file
> (or exploded WAR directory structure) will dictate the context path
> and so it need not (and should not) be specified in context.xml.
>
>>>> <Resource auth="Container"
>>>> driverClassName="oracle.jdbc.driver.OracleDriver"
>>>> factory="oracle.jdbc.pool.OracleDataSourceFactory"
>>> Do you need to use Oracle's DataSourceFactory? If not, allow
>>> Tomcat to use it's own DataSourceFactory.
>> To be safe can you tell me what change I have to do for that.
> Simply remove the "factory" attribute altogether. Tomcat knows what
> it's default is.
>
>>>> maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/dynic"
>>> I'm curious why the lookup fails with the message about "dynic"
>>> and not, as Felix asks, "jdbc/dynic".
>> I am wondering on same. Is there any way to debug this.
> Tomcat's logging usually provides some indication of a failure, but
> you haven't mentioned anything about log entries. Can you see if there
> are any log messages?
>
> Finally, try changing the "user" attribute to "username".
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk5n5MwACgkQ9CaO5/Lv0PCjoACfcadA/2p8u9VT7EdTgHTrF6Qo
> S9MAn1KxzCBXRPCzmsiYkgWI0RZl0UtB
> =9Gr4
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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


Re: JNDI configuration with 6.0.29

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anjib,

On 9/7/2011 12:57 PM, Anjib Mulepati wrote:
> 
>>> I did checked the XML file and it looks correct to me.
>>> Following is the content:
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>  <Context 
>>> antiJARLocking="true" docBase="C:\Users\amulepati\My 
>>> Projects\ClientDAOTest\build\web" path="/ClientDAOTest">
>> It probably has no bearing on this particular problem, but the
>> "path" attribute is illegal here.
> Isn't that context path of web applciation is specified with the
> "path" attribute. 
> http://tomcat.apache.org/tomcat-4.0-doc/config/context.html

You're not using Tomcat 4.0, you're using Tomcat 6.0. Look at the
documentation that is appropriate for your version of Tomcat: the
"path" attribute is only appropriate when the <Context> is defined in
server.xml, which is highly discouraged.

The name of the XML file (when deployed) or the name of the WAR file
(or exploded WAR directory structure) will dictate the context path
and so it need not (and should not) be specified in context.xml.

>>> <Resource auth="Container" 
>>> driverClassName="oracle.jdbc.driver.OracleDriver" 
>>> factory="oracle.jdbc.pool.OracleDataSourceFactory"
>> Do you need to use Oracle's DataSourceFactory? If not, allow
>> Tomcat to use it's own DataSourceFactory.
> 
> To be safe can you tell me what change I have to do for that.

Simply remove the "factory" attribute altogether. Tomcat knows what
it's default is.

>>> maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/dynic"
>> I'm curious why the lookup fails with the message about "dynic"
>> and not, as Felix asks, "jdbc/dynic".
> 
> I am wondering on same. Is there any way to debug this.

Tomcat's logging usually provides some indication of a failure, but
you haven't mentioned anything about log entries. Can you see if there
are any log messages?

Finally, try changing the "user" attribute to "username".

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5n5MwACgkQ9CaO5/Lv0PCjoACfcadA/2p8u9VT7EdTgHTrF6Qo
S9MAn1KxzCBXRPCzmsiYkgWI0RZl0UtB
=9Gr4
-----END PGP SIGNATURE-----

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


Re: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
>> I did checked the XML file and it looks correct to me. Following is
>> the content:
>>
>> <?xml version="1.0" encoding="UTF-8"?>  <Context
>> antiJARLocking="true" docBase="C:\Users\amulepati\My
>> Projects\ClientDAOTest\build\web" path="/ClientDAOTest">
> It probably has no bearing on this particular problem, but the "path"
> attribute is illegal here.
Isn't that context path of web applciation is specified with the "path" 
attribute.
http://tomcat.apache.org/tomcat-4.0-doc/config/context.html
>
>> <Resource auth="Container"
>> driverClassName="oracle.jdbc.driver.OracleDriver"
>> factory="oracle.jdbc.pool.OracleDataSourceFactory"
> Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to
> use it's own DataSourceFactory.
To be safe can you tell me what change I have to do for that.
>
>> maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/dynic"
> I'm curious why the lookup fails with the message about "dynic" and
> not, as Felix asks, "jdbc/dynic".
I am wondering on same. Is there any way to debug this.
>
>> password="sfed_schema" type="oracle.jdbc.pool.OracleDataSource"
>> url="jdbc:oracle:thin:@//localhost:4001/SAIDIT"
>> user="sfed_schema"/>
> I have "username" as the attribute in my<Resource>, but this might be
> the way you have to configure Oracle's factory. Here's what I've got
> in my configuration:
>
>     <Resource name="jdbc/db"
>      description="db"
>          auth="Container"
>          type="javax.sql.DataSource"
>          maxActive="1"
>          maxIdle="1"
>          maxWait="10000"
>          url="jdbc:[url]"
>          username="scott"
>          password="tiger"
>          driverClassName="com.mysql.jdbc.Driver"
>          removeAbandoned="true"
>          removeAbandonedTimeout="30"
>          logAbandoned="true"
>          testOnBorrow="true"
>          validationQuery="/* ping */ SELECT 1"
>      />
>
> (That "validationQuery" is a short-cut for MySQL connection testing.
> Feel free to use something like "SELECT 1 FROM DUAL" when using Oracle).
>
>> Same config work for Tomcat 7 so I am wondering is there any thing
>> I have to different/extra in Tomcat 6
> The configuration should be identical to Tomcat 6.
>
> Do you see any messages in your logs during webapp startup?
>
> I wrote a JSP-based JNDI navigator a while back but I can't seem to
> find it. Maybe I'll whip one up so you can look-around the JNDI tree
> to see if your DataSource is just misplaced. I'm sure you can write
> one yourself fairly easily, too.
Yes that will be helpful. Any clue will be appreciated.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk5nnFYACgkQ9CaO5/Lv0PAFrwCfcrpNdl8EiBvtsSc2ju5Lp7LF
> MzsAn35+pyrAivj6TtHBMWj6G6rL5+UN
> =sBGp
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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


Re: JNDI configuration with 6.0.29

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anjib,

On 9/7/2011 12:21 PM, Anjib Mulepati wrote:
> I did checked the XML file and it looks correct to me. Following is
> the content:
> 
> <?xml version="1.0" encoding="UTF-8"?> <Context
> antiJARLocking="true" docBase="C:\Users\amulepati\My 
> Projects\ClientDAOTest\build\web" path="/ClientDAOTest">

It probably has no bearing on this particular problem, but the "path"
attribute is illegal here.

> <Resource auth="Container" 
> driverClassName="oracle.jdbc.driver.OracleDriver" 
> factory="oracle.jdbc.pool.OracleDataSourceFactory"

Do you need to use Oracle's DataSourceFactory? If not, allow Tomcat to
use it's own DataSourceFactory.

> maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/dynic"

I'm curious why the lookup fails with the message about "dynic" and
not, as Felix asks, "jdbc/dynic".

> password="sfed_schema" type="oracle.jdbc.pool.OracleDataSource" 
> url="jdbc:oracle:thin:@//localhost:4001/SAIDIT" 
> user="sfed_schema"/>

I have "username" as the attribute in my <Resource>, but this might be
the way you have to configure Oracle's factory. Here's what I've got
in my configuration:

   <Resource name="jdbc/db"
    description="db"
        auth="Container"
        type="javax.sql.DataSource"
        maxActive="1"
        maxIdle="1"
        maxWait="10000"
        url="jdbc:[url]"
        username="scott"
        password="tiger"
        driverClassName="com.mysql.jdbc.Driver"
        removeAbandoned="true"
        removeAbandonedTimeout="30"
        logAbandoned="true"
        testOnBorrow="true"
        validationQuery="/* ping */ SELECT 1"
    />

(That "validationQuery" is a short-cut for MySQL connection testing.
Feel free to use something like "SELECT 1 FROM DUAL" when using Oracle).

> Same config work for Tomcat 7 so I am wondering is there any thing
> I have to different/extra in Tomcat 6

The configuration should be identical to Tomcat 6.

Do you see any messages in your logs during webapp startup?

I wrote a JSP-based JNDI navigator a while back but I can't seem to
find it. Maybe I'll whip one up so you can look-around the JNDI tree
to see if your DataSource is just misplaced. I'm sure you can write
one yourself fairly easily, too.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5nnFYACgkQ9CaO5/Lv0PAFrwCfcrpNdl8EiBvtsSc2ju5Lp7LF
MzsAn35+pyrAivj6TtHBMWj6G6rL5+UN
=sBGp
-----END PGP SIGNATURE-----

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


Re: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
I did checked the XML file and it looks correct to me. Following is the 
content:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" docBase="C:\Users\amulepati\My 
Projects\ClientDAOTest\build\web" path="/ClientDAOTest">
<Resource auth="Container"
  driverClassName="oracle.jdbc.driver.OracleDriver"
  factory="oracle.jdbc.pool.OracleDataSourceFactory"
  maxActive="20" maxIdle="10" maxWait="-1"
  name="jdbc/dynic" password="sfed_schema"
  type="oracle.jdbc.pool.OracleDataSource"
  url="jdbc:oracle:thin:@//localhost:4001/SAIDIT"
  user="sfed_schema"/>
</Context>

Same config work for Tomcat 7 so I am wondering is there any thing I 
have to different/extra in Tomcat 6

Thanks,
Anjib
On 9/7/2011 12:15 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Anjib,
>
> On 9/7/2011 11:22 AM, Anjib Mulepati wrote:
>> Yes I am positive
> If you have changed your META-INF/context.xml without doing an
> undeploy/redeploy, Tomcat may be using an older version of the
> deployment descriptor than you think it is.
>
> Take a look at CATALINA_BASE/conf/Catalina/[hostname]/[appname].xml
> and see if it contains what you expect it to contain (i.e. "jdbc/dynic").
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk5nmKEACgkQ9CaO5/Lv0PBgigCghqHFuyP7EdhO52nHXqX61CjV
> 5G8An2j+WGBaf6smXcS7MiCYrOq0iTIH
> =pVtB
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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


Re: JNDI configuration with 6.0.29

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anjib,

On 9/7/2011 11:22 AM, Anjib Mulepati wrote:
> Yes I am positive

If you have changed your META-INF/context.xml without doing an
undeploy/redeploy, Tomcat may be using an older version of the
deployment descriptor than you think it is.

Take a look at CATALINA_BASE/conf/Catalina/[hostname]/[appname].xml
and see if it contains what you expect it to contain (i.e. "jdbc/dynic").

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5nmKEACgkQ9CaO5/Lv0PBgigCghqHFuyP7EdhO52nHXqX61CjV
5G8An2j+WGBaf6smXcS7MiCYrOq0iTIH
=pVtB
-----END PGP SIGNATURE-----

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


RE: JNDI configuration with 6.0.29

Posted by Anjib Mulepati <an...@hotmail.com>.
Yes I am positive


Anjib Man Mulepati

409-225-6216


 

> Subject: Re: JNDI configuration with 6.0.29 <Reformatted>
> From: felix.schumacher@internetallee.de
> Date: Wed, 7 Sep 2011 17:17:21 +0200
> To: users@tomcat.apache.org
> 
> 
> 
> Anjib Mulepati <an...@hotmail.com> schrieb:
> 
> >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
> From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us?
> 
> Bye
>  Felix
> >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
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

Re: JNDI configuration with 6.0.29

Posted by Felix Schumacher <fe...@internetallee.de>.

Anjib Mulepati <an...@hotmail.com> schrieb:

>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
>From your code and configuration I would have expected jdbc/dynic instead of just dynic. Are you sure that you are using the code you showed us?

Bye
 Felix
>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



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