[ 
https://issues.apache.org/jira/browse/TOMEE-2024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15924221#comment-15924221
 ] 

Svetlin Zarev commented on TOMEE-2024:
--------------------------------------

I have a very simple service provider that creates non-standard resources + 
data-sources and mail sessions by delegating the actual creation to a chain of 
object factories which know how to create the resources I'm interested in. That 
service provider does not know every single object type it can create - i.e. - 
the chain of object factories can evolve independently of the service provider 
and new object factories can even be added at startup before the actual 
creation of the resources. Hence I cannot maintain a list of types in the 
service provider.
So I would expect that if I explicitly set the service provider tomee will 
honor my decision to use it and not override the otherwise correct data-sources 
with some random values.

In the very least I would expect that this message say something like : "Found 
(non) JTA dasource, but the service provider does not support the DataSource 
type" instead of the plain wrong "your jta datasource  is not jta"

> Misleading log entries
> ----------------------
>
>                 Key: TOMEE-2024
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2024
>             Project: TomEE
>          Issue Type: Bug
>    Affects Versions: 7.0.3, 7.0.4
>            Reporter: Svetlin Zarev
>            Priority: Minor
>
> Assembler:1420-1454:
> {code}
>             final String jtaWithJavaAndSlash = 
> replaceJavaAndSlash(unit.getJtaDataSource());
>             for (final String potentialName : asList(prefix + 
> jtaWithJavaAndSlash, originalJtaDataSource, jtaWithJavaAndSlash)) {
>                 if(potentialName == null) {
>                     // If unit.getJtaDataSource() is null, one of the 
> potentialName is also null.
>                     continue;
>                 }
>                 final ResourceInfo jtaInfo = 
> configFactory.getResourceInfo(potentialName);
>                 if (jtaInfo != null) {
>                     if 
> (!"false".equalsIgnoreCase(jtaInfo.properties.getProperty("JtaManaged")) // 
> don't test true since it can be missing
>                             && (jtaInfo.types.contains("DataSource") || 
> jtaInfo.types.contains(DataSource.class.getName()))) {
>                         jtaDataSourceId = jtaInfo.id;
>                         break;
>                     } else {
> ----->                        logger.warning("Found matching datasource: " + 
> jtaInfo.id + " but this one is not a JTA datasource");
>                     }
>                 }
>             }
>             final String nonJtaWithJavaAndSlash = 
> replaceJavaAndSlash(unit.getNonJtaDataSource());
>             for (final String potentialName : asList(prefix + 
> nonJtaWithJavaAndSlash, originalNonJtaDataSource, nonJtaWithJavaAndSlash)) {
>                 if(potentialName == null) {
>                     // If unit.getNonJtaDataSource() is null, one of the 
> potentialName is also null.
>                     continue;
>                 }
>                 final ResourceInfo info = 
> configFactory.getResourceInfo(potentialName);
>                 if (info != null) {
>                     if 
> (!"true".equalsIgnoreCase(info.properties.getProperty("JtaManaged"))
>                             && (info.types.contains("DataSource") || 
> info.types.contains(DataSource.class.getName()))) {
>                         nonJtaDataSourceId = info.id;
>                         break;
>                     } else {
> ----->                        logger.warning("Found matching datasource: " + 
> info.id + " but this one is a JTA datasource");
>                     }
>                 }
>             }
> {code}
> The two warnings are very misleading, because it prints that my JTA 
> data-source is NON JTA one, and my non-jta is jta data-source when my service 
> provider does not have  "javax.sql.DataSource" in the "types" property.
> Also IMO when I explicitly set the service provider it should not matter what 
> "types" it has in the service-jar.xml.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to