You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Trevor Stevens <ts...@me.com> on 2014/07/21 16:47:46 UTC

XA datasource in tomee.xml

What is the correct syntax to create an XA datasource within tomee.xml? I have tried to follow the advice on some previous mailing list posts and also using the changes introduced in https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
Trevor Stevens
tstevens@me.com

Re: XA datasource in tomee.xml

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

Well using class-name you create an instance of the specified class (using
setter or constructor ) so just use mysql attributes you need.

Using dbcp you always create a DataSource which can be backed by a
XADataSource in JTA.



Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-07-21 19:10 GMT+02:00 Trevor Stevens <ts...@me.com>:

> I didn't attempt the cast directly, when I used dbcp-alternative that was
> one of the exceptions that was thrown at startup.
>
> I was able to get the server to start without error using dbcp. However
> now I am seeing logs about unused properties. Which datasource do I add the
> jdbc xa class, url and credentials to?
>
> Also, is there a way to verify that these are being created as XA
> datasources instead of regular datasources?
>
> Trevor Stevenststevens@me.com
>
>
> On Jul 21, 2014, at 12:57 PM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
> PS: ManagedXADataSource is not a XADataSource but a DataSource delegating
> to a XADataSource.
>
> If you use the datasource directly you can use
>
> <Resource id="..." class-name="com.mysql.jdbc.jdbc2.optional.
> MysqlXADataSource"    >
> # MysqlXADataSource config
> </Resource      >
>
>
>
>
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-07-21 18:45 GMT+02:00 Àlex Soto <asotobu@gmail.com    >:
>
>        > Well I have copied the resource from Trevor and got the
> configuration from
>        > issue don't know if It is Ok for Trevor to use dbcp.
>        > @trevor Can you try with dbcp instead of dbcp-alternative?
>        >
>        > Enviat des del meu iPhone
>        >
>        > El 21/07/2014, a les 18.00, Romain Manni-Bucau <
> rmannibucau@gmail.com      > va
>        > escriure:
>        >      > @Alex: Why not DataSourceCreator = dbcp?
>        >      >
>        >      >
>        >      >
>        >      > Romain Manni-Bucau
>        >      > Twitter: @rmannibucau
>        >      > Blog: http://rmannibucau.wordpress.com/
>        >      > LinkedIn: http://fr.linkedin.com/in/rmannibucau
>        >      > Github: https://github.com/rmannibucau
>        >      >
>        >      >
>        >      > 2014-07-21 17:57 GMT+02:00 Trevor Stevens <tstevens@me.com
>        >:
>        >      >
>        >      >    > Hmm, well I assumed that this would work but it
> failed with exceptions
>        > at
>        >      >    > startup.
>        >      >    >
>        >      >    > Caused by: java.lang.ClassCastException: Cannot cast
>        >      >    >
> org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource to
>        >      >    > javax.sql.XADataSource
>        >      >    >
>        >      >    > <Resource id="test" type="DataSource"    >
>        >      >    > XaDataSource testxa
>        >      >    > DataSourceCreator dbcp-alternative
>        >      >    > </Resource  >
>        >      >    >
>        >      >    > <Resource id="testax" type="DataSource"        >
>        >      >    > JdbcDriver
> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>        >      >    > JdbcUrl jdbc:
> mysql://localhost/testdb?autoReconnect=true
>        >      >    > UserName test
>        >      >    > Password test
>        >      >    > JtaManaged true
>        >      >    > </Resource  >
>        >      >    >
>        >      >    >
>        >      >    > Trevor Stevenststevens@me.com
>        >      >    >
>        >      >    >
>        >      >    > On Jul 21, 2014, at 10:59 AM, Alex Soto <
> asotobu@gmail.com    > wrote:
>        >      >    >
>        >      >    > It seems that this approach TOMEE-1169 only works for
> TomEE 1.7.0.
>        >      >    >
>        >      >    > If you want to use tomee.xml approach you may need to
> translate system
>        >      >    > properties to tomee.xml, so for example:
>        >      >    >
>        >      >    > setProperty("db1XA", "new://Resource?type=DataSource
> ");
>        >      >    > setProperty("db1XA.XaDataSource", "db1XAUnderlying");
>        >      >    > setProperty("db1XA.DataSourceCreator",
> "dbcp-alternative"
>        >      >    >
>        >      >    >
>        >      >    > Needs to be translated to:
>        >      >    >
>        >      >    > <tomee        >
>        >      >    > <Resource id="db1XA" type="DataSource"        >
>        >      >    > XaDataSource db1XAunderlying
>        >      >    > DataSourceCreator dbcp-alternative
>        >      >    > </Resource        >
>        >      >    >
>        >      >    > Here there is an answer of Romain about this topic
>        >      >    >
>        >      >    >
>        >
> http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-support-XADataSource-td4642705.html
>        >      >    >
>        >      >    > Don't know if it helps you :)
>        >      >    >
>        >      >    >
>        >      >    >
>        >      >    > 2014-07-21 16:47 GMT+02:00 Trevor Stevens <
> tstevens@me.com        >:
>        >      >    >
>        >      >    >        > What is the correct syntax to create an XA
> datasource within
>        >      >    > tomee.xml? I
>        >      >    >        > have tried to follow the advice on some
> previous mailing list
>        >      >    > posts and
>        >      >    >        > also using the changes introduced in
>        >      >    >        >
> https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
>        >      >    >        >
>        >      >    >        > Trevor Stevenststevens@me.com
>        >      >    >
>        >      >    >
>        >      >    > --
>        >      >    >
> +----------------------------------------------------------+
>        >      >    > Alex Soto Bueno - Computer Engineer
>        >      >    > www.lordofthejars.com
>        >      >    >
> +----------------------------------------------------------+
>        >      >    >
>        >      >    >
>        >
>
>

Re: XA datasource in tomee.xml

Posted by Romain Manni-Bucau <rm...@gmail.com>.
cause originally it comes from dbcp to support pooled connections and dbcp
doesn't do it.



Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-07-21 20:16 GMT+02:00 Andy Gumbrecht <ag...@tomitribe.com>:

> Why would ManagedXADataSource not be implementing XADataSource?
>
> Andy.
>
>
> On 21/07/2014 18:56, Romain Manni-Bucau wrote:
>
>> PS: ManagedXADataSource is not a XADataSource but a DataSource delegating
>> to a XADataSource.
>>
>> If you use the datasource directly you can use
>>
>> <Resource id="..." class-name="com.mysql.jdbc.jdbc2.optional.
>> MysqlXADataSource">
>> # MysqlXADataSource config
>> </Resource>
>>
>>
>>
>>
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-07-21 18:45 GMT+02:00 Àlex Soto <as...@gmail.com>:
>>
>>  Well I have copied the resource from Trevor and got the configuration
>>> from
>>> issue don't know if It is Ok for Trevor to use dbcp.
>>> @trevor Can you try with dbcp instead of dbcp-alternative?
>>>
>>> Enviat des del meu iPhone
>>>
>>> El 21/07/2014, a les 18.00, Romain Manni-Bucau <rm...@gmail.com>
>>> va
>>> escriure:
>>>
>>>> @Alex: Why not DataSourceCreator = dbcp?
>>>>
>>>>
>>>>
>>>> Romain Manni-Bucau
>>>> Twitter: @rmannibucau
>>>> Blog: http://rmannibucau.wordpress.com/
>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>> Github: https://github.com/rmannibucau
>>>>
>>>>
>>>> 2014-07-21 17:57 GMT+02:00 Trevor Stevens <ts...@me.com>:
>>>>
>>>>  Hmm, well I assumed that this would work but it failed with exceptions
>>>>>
>>>> at
>>>
>>>> startup.
>>>>>
>>>>> Caused by: java.lang.ClassCastException: Cannot cast
>>>>> org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource to
>>>>> javax.sql.XADataSource
>>>>>
>>>>>   <Resource id="test" type="DataSource">
>>>>>     XaDataSource testxa
>>>>>     DataSourceCreator dbcp-alternative
>>>>>   </Resource>
>>>>>
>>>>>   <Resource id="testax" type="DataSource">
>>>>>       JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>>>>>       JdbcUrl jdbc:mysql://localhost/testdb?autoReconnect=true
>>>>>       UserName test
>>>>>       Password test
>>>>>       JtaManaged true
>>>>>   </Resource>
>>>>>
>>>>>
>>>>> Trevor Stevenststevens@me.com
>>>>>
>>>>>
>>>>> On Jul 21, 2014, at 10:59 AM, Alex Soto <as...@gmail.com> wrote:
>>>>>
>>>>> It seems that this approach TOMEE-1169 only works for TomEE 1.7.0.
>>>>>
>>>>> If you want to use tomee.xml approach you may need to translate system
>>>>> properties to tomee.xml, so for example:
>>>>>
>>>>> setProperty("db1XA", "new://Resource?type=DataSource");
>>>>> setProperty("db1XA.XaDataSource", "db1XAUnderlying");
>>>>> setProperty("db1XA.DataSourceCreator", "dbcp-alternative"
>>>>>
>>>>>
>>>>> Needs to be translated to:
>>>>>
>>>>> <tomee      >
>>>>> <Resource id="db1XA" type="DataSource"      >
>>>>> XaDataSource db1XAunderlying
>>>>> DataSourceCreator dbcp-alternative
>>>>> </Resource      >
>>>>>
>>>>> Here there is an answer of Romain about this topic
>>>>>
>>>>>
>>>>>  http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-
>>> support-XADataSource-td4642705.html
>>>
>>>> Don't know if it helps you :)
>>>>>
>>>>>
>>>>>
>>>>> 2014-07-21 16:47 GMT+02:00 Trevor Stevens <tstevens@me.com      >:
>>>>>
>>>>>  What is the correct syntax to create an XA datasource within
>>>>>>
>>>>> tomee.xml? I
>>>>>
>>>>>> have tried to follow the advice on some previous mailing list
>>>>>>
>>>>> posts and
>>>>>
>>>>>> also using the changes introduced in
>>>>>> https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
>>>>>>
>>>>>> Trevor Stevenststevens@me.com
>>>>>>
>>>>>
>>>>> --
>>>>> +----------------------------------------------------------+
>>>>> Alex Soto Bueno - Computer Engineer
>>>>> www.lordofthejars.com
>>>>> +----------------------------------------------------------+
>>>>>
>>>>>
>>>>>
> --
>   Andy Gumbrecht
>
>   http://www.tomitribe.com
>   agumbrecht@tomitribe.com
>   https://twitter.com/AndyGeeDe
>
>   TomEE treibt Tomitribe! | http://tomee.apache.org
>
>

Re: XA datasource in tomee.xml

Posted by Romain Manni-Bucau <rm...@gmail.com>.
yes



Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-07-21 22:01 GMT+02:00 Trevor Stevens <ts...@me.com>:

> Ok so the following starts without error. Does this look correct?
>
>   <Resource id="test" type="DataSource">
>     XaDataSource testxa
>     DataSourceCreator dbcp
>     JtaManaged true
>     testOnBorrow = true
>     testOnReturn = false
>     testWhileIdle = false
>     validationQuery = SELECT 1
>   </Resource>
>
>   <Resource id="testxa"
> class-name="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource">
>       Url jdbc:mysql://localhost/testdb?autoReconnect=true
>       User test
>       Password test
>   </Resource>
>
>
> Trevor Stevenststevens@me.com
>
>
> On Jul 21, 2014, at 02:22 PM, Alex Soto <as...@gmail.com> wrote:
>
> I am starting to loose the scope of the question hehehe I mean it seems
> that there are many different ways to resolve this, maybe we can think an
> small post about how to use XA Tx in Apache TomEE?
>
>
> 2014-07-21 20:16 GMT+02:00 Andy Gumbrecht <agumbrecht@tomitribe.com    >:
>
>        > Why would ManagedXADataSource not be implementing XADataSource?
>        >
>        > Andy.
>        >
>        >
>        > On 21/07/2014 18:56, Romain Manni-Bucau wrote:
>        >
>        >        > PS: ManagedXADataSource is not a XADataSource but a
> DataSource delegating
>        >        > to a XADataSource.
>        >        >
>        >        > If you use the datasource directly you can use
>        >        >
>        >        > <Resource id="..."
> class-name="com.mysql.jdbc.jdbc2.optional.
>        >        > MysqlXADataSource"  >
>        >        > # MysqlXADataSource config
>        >        > </Resource    >
>        >        >
>        >        >
>        >        >
>        >        >
>        >        >
>        >        >
>        >        > Romain Manni-Bucau
>        >        > Twitter: @rmannibucau
>        >        > Blog: http://rmannibucau.wordpress.com/
>        >        > LinkedIn: http://fr.linkedin.com/in/rmannibucau
>        >        > Github: https://github.com/rmannibucau
>        >        >
>        >        >
>        >        > 2014-07-21 18:45 GMT+02:00 Àlex Soto <asotobu@gmail.com
>  >:
>        >        >
>        >        > Well I have copied the resource from Trevor and got the
> configuration
>        >        >        > from
>        >        >        > issue don't know if It is Ok for Trevor to use
> dbcp.
>        >        >        > @trevor Can you try with dbcp instead of
> dbcp-alternative?
>        >        >        >
>        >        >        > Enviat des del meu iPhone
>        >        >        >
>        >        >        > El 21/07/2014, a les 18.00, Romain Manni-Bucau <
> rmannibucau@gmail.com      >
>        >        >        > va
>        >        >        > escriure:
>        >        >        >
>        >        >        >        > @Alex: Why not DataSourceCreator =
> dbcp?
>        >        >        >        >
>        >        >        >        >
>        >        >        >        >
>        >        >        >        > Romain Manni-Bucau
>        >        >        >        > Twitter: @rmannibucau
>        >        >        >        > Blog:
> http://rmannibucau.wordpress.com/
>        >        >        >        > LinkedIn:
> http://fr.linkedin.com/in/rmannibucau
>        >        >        >        > Github: https://github.com/rmannibucau
>        >        >        >        >
>        >        >        >        >
>        >        >        >        > 2014-07-21 17:57 GMT+02:00 Trevor
> Stevens <tstevens@me.com    >:
>        >        >        >        >
>        >        >        >        > Hmm, well I assumed that this would
> work but it failed with exceptions
>        >        >        >        >        >
>        >        >        >        > at
>        >        >        >
>        >        >        >        > startup.
>        >        >        >        >        >
>        >        >        >        >        > Caused by:
> java.lang.ClassCastException: Cannot cast
>        >        >        >        >        >
> org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource to
>        >        >        >        >        > javax.sql.XADataSource
>        >        >        >        >        >
>        >        >        >        >        > <Resource id="test"
> type="DataSource"  >
>        >        >        >        >        > XaDataSource testxa
>        >        >        >        >        > DataSourceCreator
> dbcp-alternative
>        >        >        >        >        > </Resource        >
>        >        >        >        >        >
>        >        >        >        >        > <Resource id="testax"
> type="DataSource"      >
>        >        >        >        >        > JdbcDriver
> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>        >        >        >        >        > JdbcUrl jdbc:
> mysql://localhost/testdb?autoReconnect=true
>        >        >        >        >        > UserName test
>        >        >        >        >        > Password test
>        >        >        >        >        > JtaManaged true
>        >        >        >        >        > </Resource        >
>        >        >        >        >        >
>        >        >        >        >        >
>        >        >        >        >        > Trevor Stevenststevens@me.com
>        >        >        >        >        >
>        >        >        >        >        >
>        >        >        >        >        > On Jul 21, 2014, at 10:59 AM,
> Alex Soto <asotobu@gmail.com    > wrote:
>        >        >        >        >        >
>        >        >        >        >        > It seems that this approach
> TOMEE-1169 only works for TomEE 1.7.0.
>        >        >        >        >        >
>        >        >        >        >        > If you want to use tomee.xml
> approach you may need to translate system
>        >        >        >        >        > properties to tomee.xml, so
> for example:
>        >        >        >        >        >
>        >        >        >        >        > setProperty("db1XA", "
> new://Resource?type=DataSource");
>        >        >        >        >        >
> setProperty("db1XA.XaDataSource", "db1XAUnderlying");
>        >        >        >        >        >
> setProperty("db1XA.DataSourceCreator", "dbcp-alternative"
>        >        >        >        >        >
>        >        >        >        >        >
>        >        >        >        >        > Needs to be translated to:
>        >        >        >        >        >
>        >        >        >        >        > <tomee        >
>        >        >        >        >        > <Resource id="db1XA"
> type="DataSource"        >
>        >        >        >        >        > XaDataSource db1XAunderlying
>        >        >        >        >        > DataSourceCreator
> dbcp-alternative
>        >        >        >        >        > </Resource        >
>        >        >        >        >        >
>        >        >        >        >        > Here there is an answer of
> Romain about this topic
>        >        >        >        >        >
>        >        >        >        >        >
>        >        >        >        >        >
> http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-
>        >        >        > support-XADataSource-td4642705.html
>        >        >        >
>        >        >        >        > Don't know if it helps you :)
>        >        >        >        >        >
>        >        >        >        >        >
>        >        >        >        >        >
>        >        >        >        >        > 2014-07-21 16:47 GMT+02:00
> Trevor Stevens <tstevens@me.com        >:
>        >        >        >        >        >
>        >        >        >        >        > What is the correct syntax to
> create an XA datasource within
>        >        >        >        >        >        >
>        >        >        >        >        > tomee.xml? I
>        >        >        >        >        >
>        >        >        >        >        >        > have tried to follow
> the advice on some previous mailing list
>        >        >        >        >        >        >
>        >        >        >        >        > posts and
>        >        >        >        >        >
>        >        >        >        >        >        > also using the
> changes introduced in
>        >        >        >        >        >        >
> https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
>        >        >        >        >        >        >
>        >        >        >        >        >        > Trevor
> Stevenststevens@me.com
>        >        >        >        >        >        >
>        >        >        >        >        >
>        >        >        >        >        > --
>        >        >        >        >        >
> +----------------------------------------------------------+
>        >        >        >        >        > Alex Soto Bueno - Computer
> Engineer
>        >        >        >        >        > www.lordofthejars.com
>        >        >        >        >        >
> +----------------------------------------------------------+
>        >        >        >        >        >
>        >        >        >        >        >
>        >        >        >        >        >
>        > --
>        > Andy Gumbrecht
>        >
>        > http://www.tomitribe.com
>        > agumbrecht@tomitribe.com
>        > https://twitter.com/AndyGeeDe
>        >
>        > TomEE treibt Tomitribe! | http://tomee.apache.org
>        >
>        >
>
>
> --
> +----------------------------------------------------------+
> Alex Soto Bueno - Computer Engineer
> www.lordofthejars.com
> +----------------------------------------------------------+
>
>

Re: XA datasource in tomee.xml

Posted by Alex Soto <as...@gmail.com>.
I am starting to loose the scope of the question hehehe I mean it seems
that there are many different ways to resolve this, maybe we can think an
small post about how to use XA Tx in Apache TomEE?


2014-07-21 20:16 GMT+02:00 Andy Gumbrecht <ag...@tomitribe.com>:

> Why would ManagedXADataSource not be implementing XADataSource?
>
> Andy.
>
>
> On 21/07/2014 18:56, Romain Manni-Bucau wrote:
>
>> PS: ManagedXADataSource is not a XADataSource but a DataSource delegating
>> to a XADataSource.
>>
>> If you use the datasource directly you can use
>>
>> <Resource id="..." class-name="com.mysql.jdbc.jdbc2.optional.
>> MysqlXADataSource">
>> # MysqlXADataSource config
>> </Resource>
>>
>>
>>
>>
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-07-21 18:45 GMT+02:00 Àlex Soto <as...@gmail.com>:
>>
>>  Well I have copied the resource from Trevor and got the configuration
>>> from
>>> issue don't know if It is Ok for Trevor to use dbcp.
>>> @trevor Can you try with dbcp instead of dbcp-alternative?
>>>
>>> Enviat des del meu iPhone
>>>
>>> El 21/07/2014, a les 18.00, Romain Manni-Bucau <rm...@gmail.com>
>>> va
>>> escriure:
>>>
>>>> @Alex: Why not DataSourceCreator = dbcp?
>>>>
>>>>
>>>>
>>>> Romain Manni-Bucau
>>>> Twitter: @rmannibucau
>>>> Blog: http://rmannibucau.wordpress.com/
>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>> Github: https://github.com/rmannibucau
>>>>
>>>>
>>>> 2014-07-21 17:57 GMT+02:00 Trevor Stevens <ts...@me.com>:
>>>>
>>>>  Hmm, well I assumed that this would work but it failed with exceptions
>>>>>
>>>> at
>>>
>>>> startup.
>>>>>
>>>>> Caused by: java.lang.ClassCastException: Cannot cast
>>>>> org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource to
>>>>> javax.sql.XADataSource
>>>>>
>>>>>   <Resource id="test" type="DataSource">
>>>>>     XaDataSource testxa
>>>>>     DataSourceCreator dbcp-alternative
>>>>>   </Resource>
>>>>>
>>>>>   <Resource id="testax" type="DataSource">
>>>>>       JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>>>>>       JdbcUrl jdbc:mysql://localhost/testdb?autoReconnect=true
>>>>>       UserName test
>>>>>       Password test
>>>>>       JtaManaged true
>>>>>   </Resource>
>>>>>
>>>>>
>>>>> Trevor Stevenststevens@me.com
>>>>>
>>>>>
>>>>> On Jul 21, 2014, at 10:59 AM, Alex Soto <as...@gmail.com> wrote:
>>>>>
>>>>> It seems that this approach TOMEE-1169 only works for TomEE 1.7.0.
>>>>>
>>>>> If you want to use tomee.xml approach you may need to translate system
>>>>> properties to tomee.xml, so for example:
>>>>>
>>>>> setProperty("db1XA", "new://Resource?type=DataSource");
>>>>> setProperty("db1XA.XaDataSource", "db1XAUnderlying");
>>>>> setProperty("db1XA.DataSourceCreator", "dbcp-alternative"
>>>>>
>>>>>
>>>>> Needs to be translated to:
>>>>>
>>>>> <tomee      >
>>>>> <Resource id="db1XA" type="DataSource"      >
>>>>> XaDataSource db1XAunderlying
>>>>> DataSourceCreator dbcp-alternative
>>>>> </Resource      >
>>>>>
>>>>> Here there is an answer of Romain about this topic
>>>>>
>>>>>
>>>>>  http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-
>>> support-XADataSource-td4642705.html
>>>
>>>> Don't know if it helps you :)
>>>>>
>>>>>
>>>>>
>>>>> 2014-07-21 16:47 GMT+02:00 Trevor Stevens <tstevens@me.com      >:
>>>>>
>>>>>  What is the correct syntax to create an XA datasource within
>>>>>>
>>>>> tomee.xml? I
>>>>>
>>>>>> have tried to follow the advice on some previous mailing list
>>>>>>
>>>>> posts and
>>>>>
>>>>>> also using the changes introduced in
>>>>>> https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
>>>>>>
>>>>>> Trevor Stevenststevens@me.com
>>>>>>
>>>>>
>>>>> --
>>>>> +----------------------------------------------------------+
>>>>> Alex Soto Bueno - Computer Engineer
>>>>> www.lordofthejars.com
>>>>> +----------------------------------------------------------+
>>>>>
>>>>>
>>>>>
> --
>   Andy Gumbrecht
>
>   http://www.tomitribe.com
>   agumbrecht@tomitribe.com
>   https://twitter.com/AndyGeeDe
>
>   TomEE treibt Tomitribe! | http://tomee.apache.org
>
>


-- 
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+

Re: XA datasource in tomee.xml

Posted by Andy Gumbrecht <ag...@tomitribe.com>.
Why would ManagedXADataSource not be implementing XADataSource?

Andy.

On 21/07/2014 18:56, Romain Manni-Bucau wrote:
> PS: ManagedXADataSource is not a XADataSource but a DataSource delegating
> to a XADataSource.
>
> If you use the datasource directly you can use
>
> <Resource id="..." class-name="com.mysql.jdbc.jdbc2.optional.
> MysqlXADataSource">
> # MysqlXADataSource config
> </Resource>
>
>
>
>
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-07-21 18:45 GMT+02:00 Àlex Soto <as...@gmail.com>:
>
>> Well I have copied the resource from Trevor and got the configuration from
>> issue don't know if It is Ok for Trevor to use dbcp.
>> @trevor Can you try with dbcp instead of dbcp-alternative?
>>
>> Enviat des del meu iPhone
>>
>> El 21/07/2014, a les 18.00, Romain Manni-Bucau <rm...@gmail.com> va
>> escriure:
>>> @Alex: Why not DataSourceCreator = dbcp?
>>>
>>>
>>>
>>> Romain Manni-Bucau
>>> Twitter: @rmannibucau
>>> Blog: http://rmannibucau.wordpress.com/
>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>> Github: https://github.com/rmannibucau
>>>
>>>
>>> 2014-07-21 17:57 GMT+02:00 Trevor Stevens <ts...@me.com>:
>>>
>>>> Hmm, well I assumed that this would work but it failed with exceptions
>> at
>>>> startup.
>>>>
>>>> Caused by: java.lang.ClassCastException: Cannot cast
>>>> org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource to
>>>> javax.sql.XADataSource
>>>>
>>>>   <Resource id="test" type="DataSource">
>>>>     XaDataSource testxa
>>>>     DataSourceCreator dbcp-alternative
>>>>   </Resource>
>>>>
>>>>   <Resource id="testax" type="DataSource">
>>>>       JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>>>>       JdbcUrl jdbc:mysql://localhost/testdb?autoReconnect=true
>>>>       UserName test
>>>>       Password test
>>>>       JtaManaged true
>>>>   </Resource>
>>>>
>>>>
>>>> Trevor Stevenststevens@me.com
>>>>
>>>>
>>>> On Jul 21, 2014, at 10:59 AM, Alex Soto <as...@gmail.com> wrote:
>>>>
>>>> It seems that this approach TOMEE-1169 only works for TomEE 1.7.0.
>>>>
>>>> If you want to use tomee.xml approach you may need to translate system
>>>> properties to tomee.xml, so for example:
>>>>
>>>> setProperty("db1XA", "new://Resource?type=DataSource");
>>>> setProperty("db1XA.XaDataSource", "db1XAUnderlying");
>>>> setProperty("db1XA.DataSourceCreator", "dbcp-alternative"
>>>>
>>>>
>>>> Needs to be translated to:
>>>>
>>>> <tomee      >
>>>> <Resource id="db1XA" type="DataSource"      >
>>>> XaDataSource db1XAunderlying
>>>> DataSourceCreator dbcp-alternative
>>>> </Resource      >
>>>>
>>>> Here there is an answer of Romain about this topic
>>>>
>>>>
>> http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-support-XADataSource-td4642705.html
>>>> Don't know if it helps you :)
>>>>
>>>>
>>>>
>>>> 2014-07-21 16:47 GMT+02:00 Trevor Stevens <tstevens@me.com      >:
>>>>
>>>>> What is the correct syntax to create an XA datasource within
>>>> tomee.xml? I
>>>>> have tried to follow the advice on some previous mailing list
>>>> posts and
>>>>> also using the changes introduced in
>>>>> https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
>>>>>
>>>>> Trevor Stevenststevens@me.com
>>>>
>>>> --
>>>> +----------------------------------------------------------+
>>>> Alex Soto Bueno - Computer Engineer
>>>> www.lordofthejars.com
>>>> +----------------------------------------------------------+
>>>>
>>>>

-- 
   Andy Gumbrecht

   http://www.tomitribe.com
   agumbrecht@tomitribe.com
   https://twitter.com/AndyGeeDe

   TomEE treibt Tomitribe! | http://tomee.apache.org


Re: XA datasource in tomee.xml

Posted by Romain Manni-Bucau <rm...@gmail.com>.
PS: ManagedXADataSource is not a XADataSource but a DataSource delegating
to a XADataSource.

If you use the datasource directly you can use

<Resource id="..." class-name="com.mysql.jdbc.jdbc2.optional.
MysqlXADataSource">
# MysqlXADataSource config
</Resource>






Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-07-21 18:45 GMT+02:00 Àlex Soto <as...@gmail.com>:

> Well I have copied the resource from Trevor and got the configuration from
> issue don't know if It is Ok for Trevor to use dbcp.
> @trevor Can you try with dbcp instead of dbcp-alternative?
>
> Enviat des del meu iPhone
>
> El 21/07/2014, a les 18.00, Romain Manni-Bucau <rm...@gmail.com> va
> escriure:
> > @Alex: Why not DataSourceCreator = dbcp?
> >
> >
> >
> > Romain Manni-Bucau
> > Twitter: @rmannibucau
> > Blog: http://rmannibucau.wordpress.com/
> > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > Github: https://github.com/rmannibucau
> >
> >
> > 2014-07-21 17:57 GMT+02:00 Trevor Stevens <ts...@me.com>:
> >
> >> Hmm, well I assumed that this would work but it failed with exceptions
> at
> >> startup.
> >>
> >> Caused by: java.lang.ClassCastException: Cannot cast
> >> org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource to
> >> javax.sql.XADataSource
> >>
> >>  <Resource id="test" type="DataSource">
> >>    XaDataSource testxa
> >>    DataSourceCreator dbcp-alternative
> >>  </Resource>
> >>
> >>  <Resource id="testax" type="DataSource">
> >>      JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
> >>      JdbcUrl jdbc:mysql://localhost/testdb?autoReconnect=true
> >>      UserName test
> >>      Password test
> >>      JtaManaged true
> >>  </Resource>
> >>
> >>
> >> Trevor Stevenststevens@me.com
> >>
> >>
> >> On Jul 21, 2014, at 10:59 AM, Alex Soto <as...@gmail.com> wrote:
> >>
> >> It seems that this approach TOMEE-1169 only works for TomEE 1.7.0.
> >>
> >> If you want to use tomee.xml approach you may need to translate system
> >> properties to tomee.xml, so for example:
> >>
> >> setProperty("db1XA", "new://Resource?type=DataSource");
> >> setProperty("db1XA.XaDataSource", "db1XAUnderlying");
> >> setProperty("db1XA.DataSourceCreator", "dbcp-alternative"
> >>
> >>
> >> Needs to be translated to:
> >>
> >> <tomee      >
> >> <Resource id="db1XA" type="DataSource"      >
> >> XaDataSource db1XAunderlying
> >> DataSourceCreator dbcp-alternative
> >> </Resource      >
> >>
> >> Here there is an answer of Romain about this topic
> >>
> >>
> http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-support-XADataSource-td4642705.html
> >>
> >> Don't know if it helps you :)
> >>
> >>
> >>
> >> 2014-07-21 16:47 GMT+02:00 Trevor Stevens <tstevens@me.com      >:
> >>
> >>> What is the correct syntax to create an XA datasource within
> >> tomee.xml? I
> >>> have tried to follow the advice on some previous mailing list
> >> posts and
> >>> also using the changes introduced in
> >>> https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
> >>>
> >>> Trevor Stevenststevens@me.com
> >>
> >>
> >> --
> >> +----------------------------------------------------------+
> >> Alex Soto Bueno - Computer Engineer
> >> www.lordofthejars.com
> >> +----------------------------------------------------------+
> >>
> >>
>

Re: XA datasource in tomee.xml

Posted by Àlex Soto <as...@gmail.com>.
Well I have copied the resource from Trevor and got the configuration from issue don't know if It is Ok for Trevor to use dbcp.
@trevor Can you try with dbcp instead of dbcp-alternative?

Enviat des del meu iPhone

El 21/07/2014, a les 18.00, Romain Manni-Bucau <rm...@gmail.com> va escriure:
> @Alex: Why not DataSourceCreator = dbcp?
> 
> 
> 
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
> 
> 
> 2014-07-21 17:57 GMT+02:00 Trevor Stevens <ts...@me.com>:
> 
>> Hmm, well I assumed that this would work but it failed with exceptions at
>> startup.
>> 
>> Caused by: java.lang.ClassCastException: Cannot cast
>> org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource to
>> javax.sql.XADataSource
>> 
>>  <Resource id="test" type="DataSource">
>>    XaDataSource testxa
>>    DataSourceCreator dbcp-alternative
>>  </Resource>
>> 
>>  <Resource id="testax" type="DataSource">
>>      JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>>      JdbcUrl jdbc:mysql://localhost/testdb?autoReconnect=true
>>      UserName test
>>      Password test
>>      JtaManaged true
>>  </Resource>
>> 
>> 
>> Trevor Stevenststevens@me.com
>> 
>> 
>> On Jul 21, 2014, at 10:59 AM, Alex Soto <as...@gmail.com> wrote:
>> 
>> It seems that this approach TOMEE-1169 only works for TomEE 1.7.0.
>> 
>> If you want to use tomee.xml approach you may need to translate system
>> properties to tomee.xml, so for example:
>> 
>> setProperty("db1XA", "new://Resource?type=DataSource");
>> setProperty("db1XA.XaDataSource", "db1XAUnderlying");
>> setProperty("db1XA.DataSourceCreator", "dbcp-alternative"
>> 
>> 
>> Needs to be translated to:
>> 
>> <tomee      >
>> <Resource id="db1XA" type="DataSource"      >
>> XaDataSource db1XAunderlying
>> DataSourceCreator dbcp-alternative
>> </Resource      >
>> 
>> Here there is an answer of Romain about this topic
>> 
>> http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-support-XADataSource-td4642705.html
>> 
>> Don't know if it helps you :)
>> 
>> 
>> 
>> 2014-07-21 16:47 GMT+02:00 Trevor Stevens <tstevens@me.com      >:
>> 
>>> What is the correct syntax to create an XA datasource within
>> tomee.xml? I
>>> have tried to follow the advice on some previous mailing list
>> posts and
>>> also using the changes introduced in
>>> https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
>>> 
>>> Trevor Stevenststevens@me.com
>> 
>> 
>> --
>> +----------------------------------------------------------+
>> Alex Soto Bueno - Computer Engineer
>> www.lordofthejars.com
>> +----------------------------------------------------------+
>> 
>> 

Re: XA datasource in tomee.xml

Posted by Romain Manni-Bucau <rm...@gmail.com>.
@Alex: Why not DataSourceCreator = dbcp?



Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-07-21 17:57 GMT+02:00 Trevor Stevens <ts...@me.com>:

> Hmm, well I assumed that this would work but it failed with exceptions at
> startup.
>
> Caused by: java.lang.ClassCastException: Cannot cast
> org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource to
> javax.sql.XADataSource
>
>   <Resource id="test" type="DataSource">
>     XaDataSource testxa
>     DataSourceCreator dbcp-alternative
>   </Resource>
>
>   <Resource id="testax" type="DataSource">
>       JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>       JdbcUrl jdbc:mysql://localhost/testdb?autoReconnect=true
>       UserName test
>       Password test
>       JtaManaged true
>   </Resource>
>
>
> Trevor Stevenststevens@me.com
>
>
> On Jul 21, 2014, at 10:59 AM, Alex Soto <as...@gmail.com> wrote:
>
> It seems that this approach TOMEE-1169 only works for TomEE 1.7.0.
>
> If you want to use tomee.xml approach you may need to translate system
> properties to tomee.xml, so for example:
>
> setProperty("db1XA", "new://Resource?type=DataSource");
> setProperty("db1XA.XaDataSource", "db1XAUnderlying");
> setProperty("db1XA.DataSourceCreator", "dbcp-alternative"
>
>
> Needs to be translated to:
>
> <tomee      >
> <Resource id="db1XA" type="DataSource"      >
> XaDataSource db1XAunderlying
> DataSourceCreator dbcp-alternative
> </Resource      >
>
> Here there is an answer of Romain about this topic
>
> http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-support-XADataSource-td4642705.html
>
> Don't know if it helps you :)
>
>
>
> 2014-07-21 16:47 GMT+02:00 Trevor Stevens <tstevens@me.com      >:
>
>        > What is the correct syntax to create an XA datasource within
> tomee.xml? I
>        > have tried to follow the advice on some previous mailing list
> posts and
>        > also using the changes introduced in
>        > https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
>        >
>        > Trevor Stevenststevens@me.com
>        >
>        >
>
>
> --
> +----------------------------------------------------------+
> Alex Soto Bueno - Computer Engineer
> www.lordofthejars.com
> +----------------------------------------------------------+
>
>

Re: XA datasource in tomee.xml

Posted by Alex Soto <as...@gmail.com>.
It seems that this approach TOMEE-1169 only works for TomEE 1.7.0.

If you want to use tomee.xml approach you may need to translate system
properties to tomee.xml, so for example:

setProperty("db1XA", "new://Resource?type=DataSource");
setProperty("db1XA.XaDataSource", "db1XAUnderlying");
            setProperty("db1XA.DataSourceCreator", "dbcp-alternative"


Needs to be translated to:

<tomee>
<Resource id="db1XA" type="DataSource">
  XaDataSource db1XAunderlying
  DataSourceCreator dbcp-alternative
</Resource>

Here there is an answer of Romain about this topic
http://tomee-openejb.979440.n4.nabble.com/Is-Tomee-not-support-XADataSource-td4642705.html

Don't know if it helps you :)



2014-07-21 16:47 GMT+02:00 Trevor Stevens <ts...@me.com>:

> What is the correct syntax to create an XA datasource within tomee.xml? I
> have tried to follow the advice on some previous mailing list posts and
> also using the changes introduced in
> https://issues.apache.org/jira/browse/TOMEE-1169 without luck.
>
> Trevor Stevenststevens@me.com
>
>


-- 
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+