You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Siemback, Chris" <Ch...@biworldwide.com> on 2011/07/12 14:27:41 UTC

Tomcat Pool and XA datasource

Hello all,

Has anyone ever been able to successfully setup an Oracle XA datasource using the newer Tomcat Pool and running Tomcat 7?  It appears the Tomcat Pool is attempting to cast the oracle XA data source to a java.sql.Driver - which it isn't.  This needs to be an XA datasource.  Anyone have luck with this - no working examples that I can find?  Here's the versions/info/error:

Software:
Tomcat 7.0.16
Tomcat Pool 1.1.0.1 http://people.apache.org/~fhanik/jdbc-pool/v1.1.0.1/apache-tomcat-jdbc-1.1.0.1-bin.zip
Oracle 11 (ojdbc6.jar)


Context.xml contents:
<Resource
                                auth="Container"
                                type="javax.sql.XADataSource"
                                factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
                                driverClassName="oracle.jdbc.xa.client.OracleXADataSource"
                                name="jdbc/mydatabase"
                                username="username"
                                password="password"
                                url="jdbc:oracle:thin:@localhost:1521:XE" />


Exception:

SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [javax.servlet.ServletException: javax.naming.NamingException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver] with root cause
javax.naming.NamingException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver
                at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
                at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
                at javax.naming.InitialContext.lookup(InitialContext.java:392)
                at org.apache.jsp.jdbc_jsp._jspService(jdbc_jsp.java:69)
                at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
                at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
                at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
                at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
                at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:286)
                at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:272)
                at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1730)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                at java.lang.Thread.run(Thread.java:662)

This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you.

Re: Tomcat Pool and XA datasource

Posted by Sylvain Goulmy <sy...@gmail.com>.
Hi Chris,

It seems that you finally arrived to set up a configuration based on the
information provided by the blog entry. I could not on my side despite many
trials.

Could you provide an exemple of configuration ?

Thanks in advance.

Cheers.
Sylvain.


On Thu, Jul 14, 2011 at 1:52 PM, Siemback, Chris <
Chris.Siemback@biworldwide.com> wrote:

> Fabulous doc - thanks Filip!  The examples are very helpful and that's the
> most thorough description of the pool options available.  I've yet to test
> the XA commit/rollback functionality, but the pool itself is up now.
> Thanks for your assistance, it was extremely helpful.
>
> Cheers,
>
> Chris
>
> -----Original Message-----
> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com]
> Sent: Wednesday, July 13, 2011 3:47 PM
> To: Tomcat Users List
> Subject: Re: Tomcat Pool and XA datasource
>
> you've misconfigured it. the driverClassName would have to be a driver.
> Using XA data sources needs to create the datasource for those connections
> first.
>
> There is an example towards the bottom of
>
>
> http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency
>
> Filip
>
> On 7/12/2011 6:27 AM, Siemback, Chris wrote:
> > Hello all,
> >
> > Has anyone ever been able to successfully setup an Oracle XA datasource
> using the newer Tomcat Pool and running Tomcat 7?  It appears the Tomcat
> Pool is attempting to cast the oracle XA data source to a java.sql.Driver -
> which it isn't.  This needs to be an XA datasource.  Anyone have luck with
> this - no working examples that I can find?  Here's the versions/info/error:
> >
> > Software:
> > Tomcat 7.0.16
> > Tomcat Pool 1.1.0.1
> http://people.apache.org/~fhanik/jdbc-pool/v1.1.0.1/apache-tomcat-jdbc-1.1.0.1-bin.zip
> > Oracle 11 (ojdbc6.jar)
> >
> >
> > Context.xml contents:
> > <Resource
> >                                  auth="Container"
> >                                  type="javax.sql.XADataSource"
> >
> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> >
> driverClassName="oracle.jdbc.xa.client.OracleXADataSource"
> >                                  name="jdbc/mydatabase"
> >                                  username="username"
> >                                  password="password"
> >                                  url="jdbc:oracle:thin:@localhost:1521:XE"
> />
> >
> >
> > Exception:
> >
> > SEVERE: Servlet.service() for servlet [jsp] in context with path []
> threw exception [javax.servlet.ServletException:
> javax.naming.NamingException: oracle.jdbc.xa.client.OracleXADataSource
> cannot be cast to java.sql.Driver] with root cause
> > javax.naming.NamingException: oracle.jdbc.xa.client.OracleXADataSource
> cannot be cast to java.sql.Driver
> >                  at
> org.apache.naming.NamingContext.lookup(NamingContext.java:843)
> >                  at
> org.apache.naming.NamingContext.lookup(NamingContext.java:145)
> >                  at
> org.apache.naming.NamingContext.lookup(NamingContext.java:814)
> >                  at
> org.apache.naming.NamingContext.lookup(NamingContext.java:145)
> >                  at
> org.apache.naming.NamingContext.lookup(NamingContext.java:814)
> >                  at
> org.apache.naming.NamingContext.lookup(NamingContext.java:145)
> >                  at
> org.apache.naming.NamingContext.lookup(NamingContext.java:814)
> >                  at
> org.apache.naming.NamingContext.lookup(NamingContext.java:159)
> >                  at
> org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
> >                  at
> javax.naming.InitialContext.lookup(InitialContext.java:392)
> >                  at org.apache.jsp.jdbc_jsp._jspService(jdbc_jsp.java:69)
> >                  at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> >                  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> >                  at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
> >                  at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
> >                  at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
> >                  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> >                  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
> >                  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> >                  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
> >                  at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
> >                  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
> >                  at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
> >                  at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
> >                  at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> >                  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
> >                  at
> org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:286)
> >                  at
> org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:272)
> >                  at
> org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1730)
> >                  at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> >                  at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> >                  at java.lang.Thread.run(Thread.java:662)
> >
> > This e-mail message is being sent solely for use by the intended
> recipient(s) and may contain confidential information.  Any unauthorized
> review, use, disclosure or distribution is prohibited.  If you are not the
> intended recipient, please contact the sender by phone or reply by e-mail,
> delete the original message and destroy all copies. Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> This e-mail message is being sent solely for use by the intended
> recipient(s) and may contain confidential information.  Any unauthorized
> review, use, disclosure or distribution is prohibited.  If you are not the
> intended recipient, please contact the sender by phone or reply by e-mail,
> delete the original message and destroy all copies. Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: Tomcat Pool and XA datasource

Posted by "Siemback, Chris" <Ch...@biworldwide.com>.
Fabulous doc - thanks Filip!  The examples are very helpful and that's the most thorough description of the pool options available.  I've yet to test the XA commit/rollback functionality, but the pool itself is up now.  Thanks for your assistance, it was extremely helpful.

Cheers,

Chris

-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
Sent: Wednesday, July 13, 2011 3:47 PM
To: Tomcat Users List
Subject: Re: Tomcat Pool and XA datasource

you've misconfigured it. the driverClassName would have to be a driver.
Using XA data sources needs to create the datasource for those connections first.

There is an example towards the bottom of

http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency

Filip

On 7/12/2011 6:27 AM, Siemback, Chris wrote:
> Hello all,
>
> Has anyone ever been able to successfully setup an Oracle XA datasource using the newer Tomcat Pool and running Tomcat 7?  It appears the Tomcat Pool is attempting to cast the oracle XA data source to a java.sql.Driver - which it isn't.  This needs to be an XA datasource.  Anyone have luck with this - no working examples that I can find?  Here's the versions/info/error:
>
> Software:
> Tomcat 7.0.16
> Tomcat Pool 1.1.0.1 http://people.apache.org/~fhanik/jdbc-pool/v1.1.0.1/apache-tomcat-jdbc-1.1.0.1-bin.zip
> Oracle 11 (ojdbc6.jar)
>
>
> Context.xml contents:
> <Resource
>                                  auth="Container"
>                                  type="javax.sql.XADataSource"
>                                  factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                                  driverClassName="oracle.jdbc.xa.client.OracleXADataSource"
>                                  name="jdbc/mydatabase"
>                                  username="username"
>                                  password="password"
>                                  url="jdbc:oracle:thin:@localhost:1521:XE" />
>
>
> Exception:
>
> SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [javax.servlet.ServletException: javax.naming.NamingException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver] with root cause
> javax.naming.NamingException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>                  at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
>                  at javax.naming.InitialContext.lookup(InitialContext.java:392)
>                  at org.apache.jsp.jdbc_jsp._jspService(jdbc_jsp.java:69)
>                  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>                  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
>                  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
>                  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
>                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
>                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
>                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>                  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
>                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
>                  at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:286)
>                  at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:272)
>                  at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1730)
>                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>                  at java.lang.Thread.run(Thread.java:662)
>
> This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you.


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


This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you.

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


Re: Tomcat Pool and XA datasource

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
you've misconfigured it. the driverClassName would have to be a driver.
Using XA data sources needs to create the datasource for those connections first.

There is an example towards the bottom of

http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency

Filip

On 7/12/2011 6:27 AM, Siemback, Chris wrote:
> Hello all,
>
> Has anyone ever been able to successfully setup an Oracle XA datasource using the newer Tomcat Pool and running Tomcat 7?  It appears the Tomcat Pool is attempting to cast the oracle XA data source to a java.sql.Driver - which it isn't.  This needs to be an XA datasource.  Anyone have luck with this - no working examples that I can find?  Here's the versions/info/error:
>
> Software:
> Tomcat 7.0.16
> Tomcat Pool 1.1.0.1 http://people.apache.org/~fhanik/jdbc-pool/v1.1.0.1/apache-tomcat-jdbc-1.1.0.1-bin.zip
> Oracle 11 (ojdbc6.jar)
>
>
> Context.xml contents:
> <Resource
>                                  auth="Container"
>                                  type="javax.sql.XADataSource"
>                                  factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                                  driverClassName="oracle.jdbc.xa.client.OracleXADataSource"
>                                  name="jdbc/mydatabase"
>                                  username="username"
>                                  password="password"
>                                  url="jdbc:oracle:thin:@localhost:1521:XE" />
>
>
> Exception:
>
> SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [javax.servlet.ServletException: javax.naming.NamingException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver] with root cause
> javax.naming.NamingException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>                  at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
>                  at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
>                  at javax.naming.InitialContext.lookup(InitialContext.java:392)
>                  at org.apache.jsp.jdbc_jsp._jspService(jdbc_jsp.java:69)
>                  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>                  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
>                  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
>                  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
>                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
>                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
>                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>                  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
>                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
>                  at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:286)
>                  at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:272)
>                  at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1730)
>                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>                  at java.lang.Thread.run(Thread.java:662)
>
> This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you.


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