hi, tomcat connection pooling problem

hi friends,

i am new to j2ee, i am geting problem while creating connection pooling,

plese somebody help me what is the mistake i am doing.

i am using tomcat 5.0.28, i am created a jndi refference with name oracleDB.

the server.xml file is like this

<Context path="/websample" docBase="websample"

debug="5" reloadable="true" crossContext="true">

<Logger className="org.apache.catalina.logger.FileLogger"

prefix="localhost_websamle_log." suffix=".txt"

timestamp="true"/>

<Resource name="jdbc/myoracle" auth="Container"

type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/myoracle">

<parameter>

<name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>

</parameter>

<parameter>

<name>driverClassName</name>

<value>oracle.jdbc.driver.OracleDriver</value>

</parameter>

<parameter>

<name>url</name>

<value>jdbc:oracle:thin:@geospace:1521:gi</value>

</parameter>

<parameter>

<name>username</name>

<value>geojava</value>

</parameter>

<parameter>

<name>password</name>

<value>geo</value>

</parameter>

<parameter>

<name>maxActive</name>

<value>20</value>

</parameter>

<parameter>

<name>maxIdle</name>

<value>10</value>

</parameter>

<parameter>

<name>maxWait</name>

<value>-1</value>

</parameter>

<parameter>

<name>removeAbandoned</name>

<value>true</value>

</parameter>

<parameter>

<name>removeAbandoned</name>

<value>true</value>

</parameter>

<parameter>

<name>logAbandoned</name>

<value>true</value>

</parameter>

</ResourceParams>

</Context>

-and my servlet is like this--

try{

Context initCtx = new InitialContext();

Context envCtx = (Context) initCtx.lookup("java:comp/env");

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

Connection con = ds.getConnection();

out.println("connnected");

}catch(Exception e){

e.printStackTrace();

out.println("this is the exception you got"+e);

--

web.xml is --

<description>oracle Test App</description>

<resource-ref>

<description>DB Connection</description>

<res-ref-name>jdbc/myoracle</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

<servlet>

<description>This is the description of my J2EE component</description>

<display-name>This is the display name of my J2EE component</display-name>

<servlet-name>StudentServlet</servlet-name>

<servlet-class>student.StudentServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>StudentServlet</servlet-name>

<url-pattern>/servlet/StudentServlet</url-pattern>

</servlet-mapping>

--

but i am getting an exception like this

javax.naming.NameNotFoundException: Name myoracle is not bound in this Context

at org.apache.naming.NamingContext.lookup(NamingContext.java:768)

at org.apache.naming.NamingContext.lookup(NamingContext.java:151)

at student.StudentServlet.doGet(StudentServlet.java:45)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

at java.lang.Thread.run(Thread.java:595)

-

i am using seperate log file for jndi resource that is mentioned as <loger..... tag above, it is showing messages like this.

2006-08-30 13:29:14 NamingContextListener[/Catalina/localhost/websample]:Resource parameters for jdbc/myoracle = ResourceParams[name=jdbc/myoracle, parameters={url=jdbc:oracle:thin:@geospace:1521:gi, maxIdle=10, maxActive=20, driverClassName=oracle.jdbc.driver.OracleDriver, maxWait=-1, removeAbandoned=true, username=geojava, factory=org.apache.commons.dbcp.BasicDataSourceFactory, logAbandoned=true, password=geo}]

2006-08-30 13:29:14 NamingContextListener[/Catalina/localhost/websample]:Adding resource ref jdbc/myoracle

2006-08-30 13:29:14 NamingContextListener[/Catalina/localhost/websample]:ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shareable},{type=auth,content=Container},{type=url,content=jdbc:oracle:thin:@geospace:1521:gi},{type=maxIdle,content=10},{type=maxActive,content=20},{type=driverClassName,content=oracle.jdbc.driver.OracleDriver},{type=maxWait,content=-1},{type=removeAbandoned,content=true},{type=username,content=geojava},{type=factory,content=org.apache.commons.dbcp.BasicDataSourceFactory},{type=logAbandoned,content=true},{type=password,content=geo}]

2006-08-30 13:29:14 NamingContextListener[/Catalina/localhost/websample]:Resource parameters for UserTransaction = null

plese somebody help me what is the mistake i am doing. i am not getting the problem iam doing

my mail id is vemulakirankumar@gmail.com

regards,

kirankumar vemula>

[7932 byte] By [kirankumarvemulaa] at [2007-10-3 3:51:11]
# 1
Hi don't worry. The problem is with server.xml. U should do without that file. Though server.xml is suggested in tomcat manual it always creates problem. Also why servelet instead of jstl?
binaryFusiona at 2007-7-14 21:48:48 > top of Java-index,Desktop,Developing for the Desktop...
# 2
Try the following forum (about JSP technology) http://forum.java.sun.com/forum.jspa?forumID=45or the following one (about EJB technology) http://forum.java.sun.com/forum.jspa?forumID=13
UncleSAMa at 2007-7-14 21:48:48 > top of Java-index,Desktop,Developing for the Desktop...