You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Jack Wang <pi...@yahoo.com> on 2006/02/08 10:44:31 UTC

XADataSource error in tomcat 5.5 with MySQL 5.1

I can get connect from Resource configured in tomcat with type="javax.sql.DataSource". But the
project needs the XADataSource, so I configure the XADataSource in tomcat's server.xml with
following:

---------------------

  <Resource name="jdbc/myXADB" auth="Container" 
    type="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
    factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
    driverClassName="com.mysql.jdbc.Driver"
    databaseName="test"
    serverName="192.168.1.2"
    explicitUrl="true"
    port="3306"
    user="root"
    password="123456"
    url="jdbc:mysql://192.168.1.2/test?useUnicode=true&amp;characterEncoding=gbk"
    />
   
or			 

  <Resource name="jdbc/myXADB" auth="Container" type="javax.sql.XADataSource"
    factory="org.objectweb.jndi.DataSourceFactory"
    driverClassName="com.mysql.jdbc.Driver"
    username="root"
    password="123456"
    url="jdbc:mysql://192.168.1.2/test"
  />
---------------------

But both can't work. I only get a null xaDs, so can not get the XAConnection. The java code in the
web application to get the XADataSource is:

---------------------
  Context ctx = new InitialContext();
  XADataSource xaDs = (XADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
  // Here get the null xaDs, Oops !!
---------------------

The error message is:

---------------------
  - Could not execute action
  java.lang.ClassCastException: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
  at example.helloWorld.HelloWorldAnotherAction.execute(HelloWorldAnotherAction.java:104)
  ......
---------------------

My environment is :
  JDK 1.5
  Tomcat 5.5
  MySQL 5.1
  Connector/J 5.0

Please ask where is the wrong ? Thanks.



Wang Jun


Wang Jun


		
___________________________________________________________
 
情人节,用雅虎邮箱送玫瑰! 


Re: XADataSource error in tomcat 5.5 with MySQL 5.1

Posted by Jack Wang <pi...@yahoo.com>.
--- lichtner <li...@bway.net>写道:
> 
> Does this version of Connector/J actually support XA? A few months ago I
> remember that it was in alpha, and it was broken. Does the latest release
> of the driver support XA?

--- "Christopher G. Stach II" <cg...@ldsys.net>写道:
> Jack Wang wrote:
> > I can get connect from Resource configured in tomcat with type="javax.sql.DataSource". But the
> > project needs the XADataSource, so I configure the XADataSource in tomcat's server.xml with
> You need to use mysql-connector-java-5.0.0-beta's
> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource with a MySQL 5.0 server,
> or the far less desirable XAPool for fake XA.
> 

I have used mysql-connector-java-5.0.0-beta, but I still have the null XADataSource xaDs from the
java action.
Here is the server.xml in tomcat:

-------------------------------------------------
<Resource name="jdbc/myXADB" auth="Container" 
  type="javax.sql.XADataSource"
  factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
  driverClassName="com.mysql.jdbc.Driver"
  user="root"
  password="password"
  url="jdbc:mysql://localhost/test?useUnicode=true&amp;characterEncoding=gbk"
/>
-------------------------------------------------

And the is my action:

-------------------------------------------------
Context ctx = new InitialContext();
XADataSource xaDs = (XADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
// Here get the null xaDs, Oops !!
-------------------------------------------------

My environment is :
 JDK 1.5
 Tomcat 5.5
 MySQL: 5.0.18-win32
 Connector/J 5.0 beta

I have checked mysql-connector-java-5.0.0-beta changes. The 11-04-05 - Version 5.0.0-beta
- XADataSource implemented (ported from 3.2 branch which won't be 
  released as a product). 
  Use "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" as your datasource
  class name in your application server to utilize XA transactions
  in MySQL-5.0.10 and newer.

So, what's the wrong ? Please help. Thanks.



Wang Jun


	

	
		
___________________________________________________________ 
雅虎1G免费邮箱百分百防垃圾信 
http://cn.mail.yahoo.com/

Re: XADataSource error in tomcat 5.5 with MySQL 5.1

Posted by Jack Wang <pi...@yahoo.com>.
--- lichtner <li...@bway.net>写道:
> 
> Does this version of Connector/J actually support XA? A few months ago I
> remember that it was in alpha, and it was broken. Does the latest release
> of the driver support XA?

--- "Christopher G. Stach II" <cg...@ldsys.net>写道:
> Jack Wang wrote:
> > I can get connect from Resource configured in tomcat with type="javax.sql.DataSource". But the
> > project needs the XADataSource, so I configure the XADataSource in tomcat's server.xml with
> You need to use mysql-connector-java-5.0.0-beta's
> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource with a MySQL 5.0 server,
> or the far less desirable XAPool for fake XA.
> 

I have used mysql-connector-java-5.0.0-beta, but I still have the null XADataSource xaDs from the
java action.
Here is the server.xml in tomcat:

-------------------------------------------------
<Resource name="jdbc/myXADB" auth="Container" 
  type="javax.sql.XADataSource"
  factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
  driverClassName="com.mysql.jdbc.Driver"
  user="root"
  password="password"
  url="jdbc:mysql://localhost/test?useUnicode=true&amp;characterEncoding=gbk"
/>
-------------------------------------------------

And the is my action:

-------------------------------------------------
Context ctx = new InitialContext();
XADataSource xaDs = (XADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
// Here get the null xaDs, Oops !!
-------------------------------------------------

My environment is :
 JDK 1.5
 Tomcat 5.5
 MySQL: 5.0.18-win32
 Connector/J 5.0 beta

I have checked mysql-connector-java-5.0.0-beta changes. The 11-04-05 - Version 5.0.0-beta
- XADataSource implemented (ported from 3.2 branch which won't be 
  released as a product). 
  Use "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" as your datasource
  class name in your application server to utilize XA transactions
  in MySQL-5.0.10 and newer.

So, what's the wrong ? Please help. Thanks.



Wang Jun


	

	
		
___________________________________________________________ 
雅虎1G免费邮箱百分百防垃圾信 
http://cn.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org


Re: XADataSource error in tomcat 5.5 with MySQL 5.1

Posted by Jack Wang <pi...@yahoo.com>.
--- lichtner <li...@bway.net>写道:
> 
> Does this version of Connector/J actually support XA? A few months ago I
> remember that it was in alpha, and it was broken. Does the latest release
> of the driver support XA?

--- "Christopher G. Stach II" <cg...@ldsys.net>写道:
> Jack Wang wrote:
> > I can get connect from Resource configured in tomcat with type="javax.sql.DataSource". But the
> > project needs the XADataSource, so I configure the XADataSource in tomcat's server.xml with
> You need to use mysql-connector-java-5.0.0-beta's
> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource with a MySQL 5.0 server,
> or the far less desirable XAPool for fake XA.
> 

I have used mysql-connector-java-5.0.0-beta, but I still have the null XADataSource xaDs from the
java action.
Here is the server.xml in tomcat:

-------------------------------------------------
<Resource name="jdbc/myXADB" auth="Container" 
  type="javax.sql.XADataSource"
  factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
  driverClassName="com.mysql.jdbc.Driver"
  user="root"
  password="password"
  url="jdbc:mysql://localhost/test?useUnicode=true&amp;characterEncoding=gbk"
/>
-------------------------------------------------

And the is my action:

-------------------------------------------------
Context ctx = new InitialContext();
XADataSource xaDs = (XADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
// Here get the null xaDs, Oops !!
-------------------------------------------------

My environment is :
 JDK 1.5
 Tomcat 5.5
 MySQL: 5.0.18-win32
 Connector/J 5.0 beta

I have checked mysql-connector-java-5.0.0-beta changes. The 11-04-05 - Version 5.0.0-beta
- XADataSource implemented (ported from 3.2 branch which won't be 
  released as a product). 
  Use "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" as your datasource
  class name in your application server to utilize XA transactions
  in MySQL-5.0.10 and newer.

So, what's the wrong ? Please help. Thanks.



Wang Jun


	

	
		
___________________________________________________________ 
雅虎1G免费邮箱百分百防垃圾信 
http://cn.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org


Re: XADataSource error in tomcat 5.5 with MySQL 5.1

Posted by lichtner <li...@bway.net>.
Does this version of Connector/J actually support XA? A few months ago I
remember that it was in alpha, and it was broken. Does the latest release
of the driver support XA?

On Wed, 8 Feb 2006, Jack Wang wrote:

> I can get connect from Resource configured in tomcat with type="javax.sql.DataSource". But the
> project needs the XADataSource, so I configure the XADataSource in tomcat's server.xml with
> following:
>
> ---------------------
>
>   <Resource name="jdbc/myXADB" auth="Container"
>     type="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
>     factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
>     driverClassName="com.mysql.jdbc.Driver"
>     databaseName="test"
>     serverName="192.168.1.2"
>     explicitUrl="true"
>     port="3306"
>     user="root"
>     password="123456"
>     url="jdbc:mysql://192.168.1.2/test?useUnicode=true&amp;characterEncoding=gbk"
>     />
>
> or
>
>   <Resource name="jdbc/myXADB" auth="Container" type="javax.sql.XADataSource"
>     factory="org.objectweb.jndi.DataSourceFactory"
>     driverClassName="com.mysql.jdbc.Driver"
>     username="root"
>     password="123456"
>     url="jdbc:mysql://192.168.1.2/test"
>   />
> ---------------------
>
> But both can't work. I only get a null xaDs, so can not get the XAConnection. The java code in the
> web application to get the XADataSource is:
>
> ---------------------
>   Context ctx = new InitialContext();
>   XADataSource xaDs = (XADataSource)ctx.lookup("java:comp/env/jdbc/myXADB");
>   // Here get the null xaDs, Oops !!
> ---------------------
>
> The error message is:
>
> ---------------------
>   - Could not execute action
>   java.lang.ClassCastException: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
>   at example.helloWorld.HelloWorldAnotherAction.execute(HelloWorldAnotherAction.java:104)
>   ......
> ---------------------
>
> My environment is :
>   JDK 1.5
>   Tomcat 5.5
>   MySQL 5.1
>   Connector/J 5.0
>
> Please ask where is the wrong ? Thanks.
>
>
>
> Wang Jun
>
>
> Wang Jun
>
>
>
> ___________________________________________________________
>
> 情人节,用雅虎邮箱送玫瑰!
>
>