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(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: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(Http11Protocol.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 in Advance 
Siva kumar

-- 
View this message in context: 
http://old.nabble.com/Universal-connection-pooling-Type-Casting-problem-tp28287054p28287054.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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

Reply via email to