You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by fa...@rohde-schwarz.com on 2018/05/09 13:05:41 UTC

Migration step of jtaManaged flag in context resources

Hi all,

 

I haven been trying to migrate from TomEE 1.7.5 to 7.0.4 but I am currently stuck with the following problem:

 

We have DataSources defined in webapp’s META-INF/context.xml as Tomcat <Resource> and there _was_ a flag called jtaManaged which apparently doesn’t exist in Tomcat 8.5 anymore. Problem is our persistence units are still JTA managed, so what I see in the log is:

 

org.apache.openejb.config.AutoConfig deploy Found matching datasource: XXX but this one is not a JTA datasource

 

An hence TomEE does the following:

org.apache.openejb.config.AutoConfig setJtaDataSource Adjusting PersistenceUnit Auditing <jta-data-source> to Resource ID 'Default JDBC Database' from 'XXX

org.apache.openejb.config.AutoConfig setNonJtaDataSource Adjusting PersistenceUnit Auditing <non-jta-data-source> to Resource ID 'Default Unmanaged JDBC Database' from 'null'

 

How can I define a DataSource inside context.xml which is still JTA managed? Or what is the correct way to migrate such a scenario? Wrapping it in JTADataSourceWrapperFacory?

 

Thanks in advance and best

Fabian

 


Re: Migration step of jtaManaged flag in context resources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le ven. 11 mai 2018 10:07, Mark Struberg <st...@yahoo.de.invalid> a
écrit :

> Do you remember (would have to look it up in the code) if the
> conf/tomee.xml overrides resource parameters defined in resources.xml from
> the WAR?
>
> Kind of:
> 1.) pickup all values from resources.xml
> 2.) add/override values from resources defined in conf/tomee.xml
>
> Does it work that way?
>

Resources.xml id are prefixed by the app name and lifecycle is managed by
the app but otherwise it is the exact same and there is no override just a
last one wins rules since override rules are handled at another layer
already (properties).



> LieGrue,
> strub
>
>
> > Am 11.05.2018 um 10:37 schrieb Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >
> > Le ven. 11 mai 2018 09:27, Mark Struberg <st...@yahoo.de.invalid> a
> > écrit :
> >
> >> Hi Fabian!
> >>
> >>
> >> To give a bit more context:
> >>
> >> Having actual db connections configured inside a WAR or EAR is usually
> >> something you'd rather like to avoid.
> >> Having passwords checked in into your source repo, needing to recompile
> if
> >> you want to tweak the connection or credentials, etc
> >> All that is simply not a really good idea.
> >>
> >> This problem is imo best solved by separating off all configuration and
> >> kind of 'infrastructure' setup from your own appliaction source and
> provide
> >> it via the container.
> >>
> >> TLDR; I recommend configuring DataSources and stuff in the container and
> >> not in your WAR: Just use /conf/tomee.xml [1].
> >> And you can ofc also encrypt your passwords [2] so they are not stored
> in
> >> plain text.
> >>
> >
> >
> > Mark, dont forget you can use placeholders with default for all values in
> > the war but it hardcodes mandatory things like jtaManaged + exposes the
> > config as needed by the app and not the tomee way which can be undesired
> or
> > not consistent with the app way ;)
> >
> >
> >> LieGrue,
> >> strub
> >>
> >>
> >> [1] https://tomee.apache.org/configuring-datasources.html
> >> [2] https://tomee.apache.org/datasource-password-encryption.html
> >>
> >>> Am 09.05.2018 um 17:21 schrieb Romain Manni-Bucau <
> rmannibucau@gmail.com
> >>> :
> >>>
> >>> Hi
> >>>
> >>> Just use resources.xml
> >>>
> >>> Le mer. 9 mai 2018 14:05, <fa...@rohde-schwarz.com> a
> écrit :
> >>>
> >>>> Hi all,
> >>>>
> >>>>
> >>>>
> >>>> I haven been trying to migrate from TomEE 1.7.5 to 7.0.4 but I am
> >>>> currently stuck with the following problem:
> >>>>
> >>>>
> >>>>
> >>>> We have DataSources defined in webapp’s META-INF/context.xml as Tomcat
> >>>> <Resource> and there _*was*_ a flag called jtaManaged which apparently
> >>>> doesn’t exist in Tomcat 8.5 anymore. Problem is our persistence units
> >> are
> >>>> still JTA managed, so what I see in the log is:
> >>>>
> >>>>
> >>>>
> >>>> org.apache.openejb.config.AutoConfig deploy Found matching datasource:
> >> XXX
> >>>> but this one is not a JTA datasource
> >>>>
> >>>>
> >>>>
> >>>> An hence TomEE does the following:
> >>>>
> >>>> org.apache.openejb.config.AutoConfig setJtaDataSource Adjusting
> >>>> PersistenceUnit Auditing <jta-data-source> to Resource ID 'Default
> JDBC
> >>>> Database' from 'XXX
> >>>>
> >>>> org.apache.openejb.config.AutoConfig setNonJtaDataSource Adjusting
> >>>> PersistenceUnit Auditing <non-jta-data-source> to Resource ID 'Default
> >>>> Unmanaged JDBC Database' from 'null'
> >>>>
> >>>>
> >>>>
> >>>> How can I define a DataSource inside context.xml which is still JTA
> >>>> managed? Or what is the correct way to migrate such a scenario?
> >> Wrapping it
> >>>> in JTADataSourceWrapperFacory?
> >>>>
> >>>>
> >>>>
> >>>> Thanks in advance and best
> >>>>
> >>>> Fabian
>
>

Re: Migration step of jtaManaged flag in context resources

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Do you remember (would have to look it up in the code) if the conf/tomee.xml overrides resource parameters defined in resources.xml from the WAR?

Kind of:
1.) pickup all values from resources.xml
2.) add/override values from resources defined in conf/tomee.xml

Does it work that way?

LieGrue,
strub


> Am 11.05.2018 um 10:37 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> Le ven. 11 mai 2018 09:27, Mark Struberg <st...@yahoo.de.invalid> a
> écrit :
> 
>> Hi Fabian!
>> 
>> 
>> To give a bit more context:
>> 
>> Having actual db connections configured inside a WAR or EAR is usually
>> something you'd rather like to avoid.
>> Having passwords checked in into your source repo, needing to recompile if
>> you want to tweak the connection or credentials, etc
>> All that is simply not a really good idea.
>> 
>> This problem is imo best solved by separating off all configuration and
>> kind of 'infrastructure' setup from your own appliaction source and provide
>> it via the container.
>> 
>> TLDR; I recommend configuring DataSources and stuff in the container and
>> not in your WAR: Just use /conf/tomee.xml [1].
>> And you can ofc also encrypt your passwords [2] so they are not stored in
>> plain text.
>> 
> 
> 
> Mark, dont forget you can use placeholders with default for all values in
> the war but it hardcodes mandatory things like jtaManaged + exposes the
> config as needed by the app and not the tomee way which can be undesired or
> not consistent with the app way ;)
> 
> 
>> LieGrue,
>> strub
>> 
>> 
>> [1] https://tomee.apache.org/configuring-datasources.html
>> [2] https://tomee.apache.org/datasource-password-encryption.html
>> 
>>> Am 09.05.2018 um 17:21 schrieb Romain Manni-Bucau <rmannibucau@gmail.com
>>> :
>>> 
>>> Hi
>>> 
>>> Just use resources.xml
>>> 
>>> Le mer. 9 mai 2018 14:05, <fa...@rohde-schwarz.com> a écrit :
>>> 
>>>> Hi all,
>>>> 
>>>> 
>>>> 
>>>> I haven been trying to migrate from TomEE 1.7.5 to 7.0.4 but I am
>>>> currently stuck with the following problem:
>>>> 
>>>> 
>>>> 
>>>> We have DataSources defined in webapp’s META-INF/context.xml as Tomcat
>>>> <Resource> and there _*was*_ a flag called jtaManaged which apparently
>>>> doesn’t exist in Tomcat 8.5 anymore. Problem is our persistence units
>> are
>>>> still JTA managed, so what I see in the log is:
>>>> 
>>>> 
>>>> 
>>>> org.apache.openejb.config.AutoConfig deploy Found matching datasource:
>> XXX
>>>> but this one is not a JTA datasource
>>>> 
>>>> 
>>>> 
>>>> An hence TomEE does the following:
>>>> 
>>>> org.apache.openejb.config.AutoConfig setJtaDataSource Adjusting
>>>> PersistenceUnit Auditing <jta-data-source> to Resource ID 'Default JDBC
>>>> Database' from 'XXX
>>>> 
>>>> org.apache.openejb.config.AutoConfig setNonJtaDataSource Adjusting
>>>> PersistenceUnit Auditing <non-jta-data-source> to Resource ID 'Default
>>>> Unmanaged JDBC Database' from 'null'
>>>> 
>>>> 
>>>> 
>>>> How can I define a DataSource inside context.xml which is still JTA
>>>> managed? Or what is the correct way to migrate such a scenario?
>> Wrapping it
>>>> in JTADataSourceWrapperFacory?
>>>> 
>>>> 
>>>> 
>>>> Thanks in advance and best
>>>> 
>>>> Fabian


Re: Migration step of jtaManaged flag in context resources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le ven. 11 mai 2018 09:27, Mark Struberg <st...@yahoo.de.invalid> a
écrit :

> Hi Fabian!
>
>
> To give a bit more context:
>
> Having actual db connections configured inside a WAR or EAR is usually
> something you'd rather like to avoid.
> Having passwords checked in into your source repo, needing to recompile if
> you want to tweak the connection or credentials, etc
> All that is simply not a really good idea.
>
> This problem is imo best solved by separating off all configuration and
> kind of 'infrastructure' setup from your own appliaction source and provide
> it via the container.
>
> TLDR; I recommend configuring DataSources and stuff in the container and
> not in your WAR: Just use /conf/tomee.xml [1].
> And you can ofc also encrypt your passwords [2] so they are not stored in
> plain text.
>


Mark, dont forget you can use placeholders with default for all values in
the war but it hardcodes mandatory things like jtaManaged + exposes the
config as needed by the app and not the tomee way which can be undesired or
not consistent with the app way ;)


> LieGrue,
> strub
>
>
> [1] https://tomee.apache.org/configuring-datasources.html
> [2] https://tomee.apache.org/datasource-password-encryption.html
>
> > Am 09.05.2018 um 17:21 schrieb Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >
> > Hi
> >
> > Just use resources.xml
> >
> > Le mer. 9 mai 2018 14:05, <fa...@rohde-schwarz.com> a écrit :
> >
> >> Hi all,
> >>
> >>
> >>
> >> I haven been trying to migrate from TomEE 1.7.5 to 7.0.4 but I am
> >> currently stuck with the following problem:
> >>
> >>
> >>
> >> We have DataSources defined in webapp’s META-INF/context.xml as Tomcat
> >> <Resource> and there _*was*_ a flag called jtaManaged which apparently
> >> doesn’t exist in Tomcat 8.5 anymore. Problem is our persistence units
> are
> >> still JTA managed, so what I see in the log is:
> >>
> >>
> >>
> >> org.apache.openejb.config.AutoConfig deploy Found matching datasource:
> XXX
> >> but this one is not a JTA datasource
> >>
> >>
> >>
> >> An hence TomEE does the following:
> >>
> >> org.apache.openejb.config.AutoConfig setJtaDataSource Adjusting
> >> PersistenceUnit Auditing <jta-data-source> to Resource ID 'Default JDBC
> >> Database' from 'XXX
> >>
> >> org.apache.openejb.config.AutoConfig setNonJtaDataSource Adjusting
> >> PersistenceUnit Auditing <non-jta-data-source> to Resource ID 'Default
> >> Unmanaged JDBC Database' from 'null'
> >>
> >>
> >>
> >> How can I define a DataSource inside context.xml which is still JTA
> >> managed? Or what is the correct way to migrate such a scenario?
> Wrapping it
> >> in JTADataSourceWrapperFacory?
> >>
> >>
> >>
> >> Thanks in advance and best
> >>
> >> Fabian
> >>
> >>
> >>
>
>

Re: Migration step of jtaManaged flag in context resources

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Hi Fabian!


To give a bit more context:

Having actual db connections configured inside a WAR or EAR is usually something you'd rather like to avoid.
Having passwords checked in into your source repo, needing to recompile if you want to tweak the connection or credentials, etc
All that is simply not a really good idea.

This problem is imo best solved by separating off all configuration and kind of 'infrastructure' setup from your own appliaction source and provide it via the container.

TLDR; I recommend configuring DataSources and stuff in the container and not in your WAR: Just use /conf/tomee.xml [1].
And you can ofc also encrypt your passwords [2] so they are not stored in plain text.

LieGrue,
strub


[1] https://tomee.apache.org/configuring-datasources.html
[2] https://tomee.apache.org/datasource-password-encryption.html

> Am 09.05.2018 um 17:21 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> Hi
> 
> Just use resources.xml
> 
> Le mer. 9 mai 2018 14:05, <fa...@rohde-schwarz.com> a écrit :
> 
>> Hi all,
>> 
>> 
>> 
>> I haven been trying to migrate from TomEE 1.7.5 to 7.0.4 but I am
>> currently stuck with the following problem:
>> 
>> 
>> 
>> We have DataSources defined in webapp’s META-INF/context.xml as Tomcat
>> <Resource> and there _*was*_ a flag called jtaManaged which apparently
>> doesn’t exist in Tomcat 8.5 anymore. Problem is our persistence units are
>> still JTA managed, so what I see in the log is:
>> 
>> 
>> 
>> org.apache.openejb.config.AutoConfig deploy Found matching datasource: XXX
>> but this one is not a JTA datasource
>> 
>> 
>> 
>> An hence TomEE does the following:
>> 
>> org.apache.openejb.config.AutoConfig setJtaDataSource Adjusting
>> PersistenceUnit Auditing <jta-data-source> to Resource ID 'Default JDBC
>> Database' from 'XXX
>> 
>> org.apache.openejb.config.AutoConfig setNonJtaDataSource Adjusting
>> PersistenceUnit Auditing <non-jta-data-source> to Resource ID 'Default
>> Unmanaged JDBC Database' from 'null'
>> 
>> 
>> 
>> How can I define a DataSource inside context.xml which is still JTA
>> managed? Or what is the correct way to migrate such a scenario? Wrapping it
>> in JTADataSourceWrapperFacory?
>> 
>> 
>> 
>> Thanks in advance and best
>> 
>> Fabian
>> 
>> 
>> 


Re: Migration step of jtaManaged flag in context resources

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

Just use resources.xml

Le mer. 9 mai 2018 14:05, <fa...@rohde-schwarz.com> a écrit :

> Hi all,
>
>
>
> I haven been trying to migrate from TomEE 1.7.5 to 7.0.4 but I am
> currently stuck with the following problem:
>
>
>
> We have DataSources defined in webapp’s META-INF/context.xml as Tomcat
> <Resource> and there _*was*_ a flag called jtaManaged which apparently
> doesn’t exist in Tomcat 8.5 anymore. Problem is our persistence units are
> still JTA managed, so what I see in the log is:
>
>
>
> org.apache.openejb.config.AutoConfig deploy Found matching datasource: XXX
> but this one is not a JTA datasource
>
>
>
> An hence TomEE does the following:
>
> org.apache.openejb.config.AutoConfig setJtaDataSource Adjusting
> PersistenceUnit Auditing <jta-data-source> to Resource ID 'Default JDBC
> Database' from 'XXX
>
> org.apache.openejb.config.AutoConfig setNonJtaDataSource Adjusting
> PersistenceUnit Auditing <non-jta-data-source> to Resource ID 'Default
> Unmanaged JDBC Database' from 'null'
>
>
>
> How can I define a DataSource inside context.xml which is still JTA
> managed? Or what is the correct way to migrate such a scenario? Wrapping it
> in JTADataSourceWrapperFacory?
>
>
>
> Thanks in advance and best
>
> Fabian
>
>
>