this is an exact cut/paste from an earlier post, it won't help you repeating the same questions.
regards, Harry 2010/4/19 Thangavelu.V <thangavel...@yalamanchili.co.in> > Hi Friends, > I am using universal connection pooling for connecting database , > while configuring manually i able to connect to database,but while > configuring in server.xml i am unable to cast the datasource i am getting > the class cast exception, please find the below configuration and error > details , correct me if i configured wrong , I am using Tomcat 6.0 > > server.xml configurartion > > <Context docBase="UCP" path="/UCP" reloadable="true" > source="org.eclipse.jst.jee.server:UCP"> > <Resource auth="Container" description="DataSource Reference" > driverClassName="oracle.jdbc.OracleDriver" > maxActive="4" maxIdle="2" maxWait="5000" > name="jdbc/oracleds" factory="oracle.jdbc.pool.OracleDataSource" > username="branch" password="branch" > type="oracle.ucp.jdbc.PoolDataSourceImpl" > url="jdbc:oracle:thin:@//192.168.203.12:1521/ycs" > validationQuery="select 1 from dual"/> > </Context> > > Error Details > javax.naming.NamingException: Could not create resource factory instance > [Root exception is java.lang.ClassCastException: > oracle.jdbc.pool.OracleDataSource cannot be cast to > javax.naming.spi.ObjectFactory] > at > > org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory. > java:102) > 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 TestServlet.doGet(TestServlet.java:37) > 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(Application > FilterChain.java:290) > at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh > ain.java:206) > at > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja > va:233) > at > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja > va:191) > at > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128 > ) > 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:293) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) > at > > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http > 11Protocol.java:583) > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) > at java.lang.Thread.run(Thread.java:619) > Caused by: java.lang.ClassCastException: oracle.jdbc.pool.OracleDataSource > cannot be cast to javax.naming.spi.ObjectFactory > at > > org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory. > java:98) > ... 20 more > > > Java code for retrieving connection > > Context initContext; > try { > initContext = new InitialContext(); > > Context envContext = > (Context)initContext.lookup("java:/comp/env"); > DataSource ds = > (DataSource)envContext.lookup("jdbc/oracleds"); > } catch (NamingException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > > > > > > Thanks and Regards, > > V.Thangavelu > > Software Engineer > > "This e-mail message may contain confidential, proprietary or legally > privileged information. It should not be used by anyone who is not the > original intended recipient. If you have erroneously received this message, > please delete it immediately and notify the sender. The recipient > acknowledges that YALAMANCHILI or its subsidiaries and associated > companies, > are unable to exercise control or ensure or guarantee the integrity of/over > the contents of the information contained in e-mail transmissions and > further acknowledges that any views expressed in this message are those of > the individual sender and no binding nature of the message shall be implied > or assumed unless the sender does so expressly with due authority of > YALAMANCHILI Group. Before opening any attachments please check them for > viruses and defects." > > > >