You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Loïc Tregan <l....@gmail.com> on 2014/09/19 20:15:06 UTC

Should logEffectiveWebXml=true log web fragments ? tomcat 7.0

Hi,

Setting logEffectiveWebXml=true in context.xml does not log the web
fragments in the <absolute-ordering> clause of the output web.xml; it is
not specified.

Is it expected ? Should I file a bug ?

I think it is a convenient feature to debug in which order the web
fragments are loaded.

thanks,

loic

Re: Should logEffectiveWebXml=true log web fragments ? tomcat 7.0

Posted by Loïc Tregan <l....@gmail.com>.
On Mon, Sep 22, 2014 at 11:55 AM, Loïc Tregan <l....@gmail.com> wrote:

>
> 2. See
>>             // Step 6. Merge web-fragment.xml files into the main web.xml
>>             // file.
>>             if (ok) {
>>                 ok = webXml.merge(orderedFragments);
>>             }
>>
>> That Step 10 that you cited is about static resources
>> (META-INF/resources/ files) and nothing else.
>>
>>
>

In org.apache.tomcat.util.descriptor.web.WebXml.toXml(): there is no
<absolute-ordering> display output.

Although the merge happens in step 6 as you noted, it explains why there is
nothing logged. The impact is that the user does not know in which order
the fragments are loaded (note that the definition of web fragment is loose
in that context, it actually include all JARs - they are part of
ordered-fragments even if just a regular jar, which can be told because
their getName() starts with "jar:").


Should I submit a bug for that issue ?

Thanks,

loic

Re: Should logEffectiveWebXml=true log web fragments ? tomcat 7.0

Posted by Loïc Tregan <l....@gmail.com>.
> 2. See
>             // Step 6. Merge web-fragment.xml files into the main web.xml
>             // file.
>             if (ok) {
>                 ok = webXml.merge(orderedFragments);
>             }
>
> That Step 10 that you cited is about static resources
> (META-INF/resources/ files) and nothing else.
>
>
ok, issue might be somewhere else then. I am pretty positive I have no
absolute-ordering clause in the logged effective xml, my web fragments are
not listed in this file but my webfragments are called - found by discovery
as there is no absolute ordering clause.

I'll try to reproduce the issue in a minimal example. In the meantime, let
me know if you have seen it work !

thanks,

loic

Re: Should logEffectiveWebXml=true log web fragments ? tomcat 7.0

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-09-22 12:01 GMT+04:00 Loïc Tregan <l....@gmail.com>:
> Hi Konstantin,
>
> I am referring to this code in ContextConfig.java:
>
> // Step 9a. Make the merged web.xml available to other
>         if (context.getLogEffectiveWebXml()) {
>             log.info("web.xml:\n" + mergedWebXml);
>         }
>
>  // Step 10. Look for static resources packaged in JARs
>                    Set<WebXml> resourceJars = new LinkedHashSet<>();
>             if (orderedFragments != null) {
>                 for (WebXml fragment : orderedFragments) {
>                     resourceJars.add(fragment);
>                 }
>             }
>             for (WebXml fragment : fragments.values()) {
>                 if (!resourceJars.contains(fragment)) {
>                     resourceJars.add(fragment);
>                 }
>             }
>             processResourceJARs(resourceJars);
>
>
> Apparently, it is only after logging mergeXml that the fragments are
> considered; mergedWebXml thus has empty empty fragments at the time of
> logging - and is not populated afterwards I believe (or - maybe - partially
> populated without the full set of resourceJars) . It matches my experience.
>
> Do you think I should file a bug and log the merged Xml after resourceJars
> is indeed complete ?
>
> Thanks,
>
> loïc
>
>
> On Sat, Sep 20, 2014 at 1:09 PM, Konstantin Kolinko <kn...@gmail.com>
> wrote:
>
>> 2014-09-19 22:15 GMT+04:00 Loïc Tregan <l....@gmail.com>:
>> > Hi,
>> >
>> > Setting logEffectiveWebXml=true in context.xml does not log the web
>> > fragments in the <absolute-ordering> clause of the output web.xml; it is
>> > not specified.
>> >
>> > Is it expected ? Should I file a bug ?
>> >
>> > I think it is a convenient feature to debug in which order the web
>> > fragments are loaded.
>>
>> It logs web.xml created from merging of all processed fragments and
>> annotations.
>>
>> If data from your fragment are not included in the resulting web.xml,
>> it means that you fragment is not effective (ignored, misconfigured
>> etc.)
>>
>>
>> If you need more specific help, you need to provide enough information
>> for someone else to reproduce your issue.
>>
>> Check what version of specification your files are declaring.
>> Cross-check your expectations with the Servlet specification text.


1. Rules of this mailing list: do not top-post.
http://tomcat.apache.org/lists.html#tomcat-users

2. See
            // Step 6. Merge web-fragment.xml files into the main web.xml
            // file.
            if (ok) {
                ok = webXml.merge(orderedFragments);
            }

That Step 10 that you cited is about static resources
(META-INF/resources/ files) and nothing else.

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


Re: Should logEffectiveWebXml=true log web fragments ? tomcat 7.0

Posted by Loïc Tregan <l....@gmail.com>.
Hi Konstantin,

I am referring to this code in ContextConfig.java:

// Step 9a. Make the merged web.xml available to other
        if (context.getLogEffectiveWebXml()) {
            log.info("web.xml:\n" + mergedWebXml);
        }

 // Step 10. Look for static resources packaged in JARs
                   Set<WebXml> resourceJars = new LinkedHashSet<>();
            if (orderedFragments != null) {
                for (WebXml fragment : orderedFragments) {
                    resourceJars.add(fragment);
                }
            }
            for (WebXml fragment : fragments.values()) {
                if (!resourceJars.contains(fragment)) {
                    resourceJars.add(fragment);
                }
            }
            processResourceJARs(resourceJars);


Apparently, it is only after logging mergeXml that the fragments are
considered; mergedWebXml thus has empty empty fragments at the time of
logging - and is not populated afterwards I believe (or - maybe - partially
populated without the full set of resourceJars) . It matches my experience.

Do you think I should file a bug and log the merged Xml after resourceJars
is indeed complete ?

Thanks,

loïc


On Sat, Sep 20, 2014 at 1:09 PM, Konstantin Kolinko <kn...@gmail.com>
wrote:

> 2014-09-19 22:15 GMT+04:00 Loïc Tregan <l....@gmail.com>:
> > Hi,
> >
> > Setting logEffectiveWebXml=true in context.xml does not log the web
> > fragments in the <absolute-ordering> clause of the output web.xml; it is
> > not specified.
> >
> > Is it expected ? Should I file a bug ?
> >
> > I think it is a convenient feature to debug in which order the web
> > fragments are loaded.
>
> It logs web.xml created from merging of all processed fragments and
> annotations.
>
> If data from your fragment are not included in the resulting web.xml,
> it means that you fragment is not effective (ignored, misconfigured
> etc.)
>
>
> If you need more specific help, you need to provide enough information
> for someone else to reproduce your issue.
>
> Check what version of specification your files are declaring.
> Cross-check your expectations with the Servlet specification text.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Should logEffectiveWebXml=true log web fragments ? tomcat 7.0

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-09-19 22:15 GMT+04:00 Loïc Tregan <l....@gmail.com>:
> Hi,
>
> Setting logEffectiveWebXml=true in context.xml does not log the web
> fragments in the <absolute-ordering> clause of the output web.xml; it is
> not specified.
>
> Is it expected ? Should I file a bug ?
>
> I think it is a convenient feature to debug in which order the web
> fragments are loaded.

It logs web.xml created from merging of all processed fragments and annotations.

If data from your fragment are not included in the resulting web.xml,
it means that you fragment is not effective (ignored, misconfigured
etc.)


If you need more specific help, you need to provide enough information
for someone else to reproduce your issue.

Check what version of specification your files are declaring.
Cross-check your expectations with the Servlet specification text.

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