You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Thangavelu.V" <th...@yalamanchili.co.in> on 2010/04/19 06:36:06 UTC
Oracle Universal connection pooling type cast problem while configuring in server.xml
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."
RE: Oracle Universal connection pooling type cast problem while
configuring in server.xml
Posted by "Propes, Barry L " <ba...@citi.com>.
V.Thangavelu,
I ran into a similar error as what you state below a month or so ago.
Chuck Caldarale had made the suggestion, and it turned out to be the elixir for me, was to make ABSOLUTELY sure you had NO other classes (or jar files) of the same name, i.e. tomcat-dbcp.jar, floating around elsewhere in the directory anywhere.
It not only can, but will wreak havoc on this DBCP connection.
Double check that, clean it out if you find extras, kill of the context.xml file created from META-INF/ in the conf directory.
And try again.
That worked wonders for me.
Barry
-----Original Message-----
From: Harry Metske [mailto:harry.metske@gmail.com]
Sent: Monday, April 19, 2010 2:04 AM
To: Tomcat Users List
Subject: Re: Oracle Universal connection pooling type cast problem while configuring in server.xml
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 <th...@yalamanchili.co.in>
>
> 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)
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle Universal connection pooling type cast problem while
configuring in server.xml
Posted by Harry Metske <ha...@gmail.com>.
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 <th...@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."
>
>
>
>