You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hoa Phan <s5...@gmail.com> on 2017/03/09 13:15:39 UTC

What is the correct way to use scanManifest

Hi,

I see that since 8.0.38 we added a scanManifest props to JarScanner.
But when I added the props
into: container/tomcat8x/apache-tomcat-8.0.38/conf/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat
restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve
className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
<JarScanner scanManifest="false" /></Context>

It doesn't work and the prop is still true on startup:

​
Must I put this in the context.xml of the webapp itself. I deploy the
webapp via a war file and have no control over the war content until tomcat
deploys it which is too late...

Is there any other way for me to turn this off using global config of
tomcat.

Thanks much.

Regards,

Hoa Phan

Re: What is the correct way to use scanManifest

Posted by Mark Thomas <ma...@apache.org>.
On 10/03/17 00:14, Hoa Phan wrote:
> looks like I can't overwrite the webapp context.xml with tomcat
> context.xml. I have no control over the WAR file until tomcat deployed it :(

I have confirmed (via remote debugging) that using

<Context ...>
   ...
   <JarScanner scanManifest="false" />
</Context>

in $CATALINA_BASE/conf/context.xml disables manifest processing.


> If I try to use tomcat server.xml and add
> <Context>
> 
>   <JarScanner scanManifest="false"/>
> 
> </Context>
> 
> inside <Host> it somehow breaks the webapp.

That is expected. The above snippet is invalid in server.xml.

> Is there any other way for me to set this scanmanifest to false.

You need to figure out what you are doing wrong with conf/context.xml

Mark


> 
> Says if I took all the jars that I saw reported as
> WARNING: Failed to scan...
> java.io.FileNotFoundException: .../common/lib/jonas_timer.jar (No such file
> or directory)
> 
> And append them to:
> tomcat.util.scan.StandardJarScanFilter.jarsToSkip
> 
> in catalina.properties, would that help ?
> 
> On Fri, Mar 10, 2017 at 10:33 AM, Mark Thomas <ma...@apache.org> wrote:
> 
>> On 09/03/17 21:38, Hoa Phan wrote:
>>> I'll try that and see how it goes, thanks Mark. Btw, when I was
>> debugging I
>>> couldn't find where this method get called at all:
>>>     public void setScanManifest(boolean scanManifest) {
>>>         this.scanManifest = scanManifest;
>>>     }
>>>
>>> This props default to true:
>>>     private boolean scanManifest = true;
>>>
>>> And the StandardJarScanner always been constructed like:
>>>             jarScanner = new StandardJarScanner();
>>>
>>> How would scanManifest ever be set to false...
>>
>> Via the digester when processing server.xml or context.xml. Take a look
>> at org.apache.catalina.startup.ContextRuleSet
>>
>> Mark
>>
>>
>>>
>>> Regards,
>>>
>>> Hoa Phan.
>>>
>>>
>>>
>>>
>>> On Fri, Mar 10, 2017 at 6:44 AM, Mark Thomas <ma...@apache.org> wrote:
>>>
>>>> On 09/03/17 13:15, Hoa Phan wrote:
>>>>> Hi,
>>>>>
>>>>> I see that since 8.0.38 we added a scanManifest props to JarScanner.
>>>>> But when I added the props
>>>>> into: container/tomcat8x/apache-tomcat-8.0.38/conf/context.xml
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <Context>
>>>>>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>>>>     <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
>>>>>
>>>>>     <!-- Uncomment this to disable session persistence across Tomcat
>>>>> restarts -->
>>>>>     <!--
>>>>>     <Manager pathname="" />
>>>>>     -->
>>>>>
>>>>>     <!-- Uncomment this to enable Comet connection tacking (provides
>>>> events
>>>>>          on session expiration as well as webapp lifecycle) -->
>>>>>     <!--
>>>>>     <Valve
>>>>> className="org.apache.catalina.valves.CometConnectionManagerValve" />
>>>>>     -->
>>>>> <JarScanner scanManifest="false" /></Context>
>>>>>
>>>>> It doesn't work and the prop is still true on startup:
>>>>
>>>> Hmm. That should work. Are you sure that file is being read at startup?
>>>> One way to check is to deliberately break it and see what happens.
>>>>
>>>> Mark
>>>>
>>>>
>>>>>
>>>>> \u200b
>>>>> Must I put this in the context.xml of the webapp itself. I deploy the
>>>>> webapp via a war file and have no control over the war content until
>>>>> tomcat deploys it which is too late...
>>>>>
>>>>> Is there any other way for me to turn this off using global config of
>>>>> tomcat.
>>>>>
>>>>> Thanks much.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Hoa Phan
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 


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


Re: What is the correct way to use scanManifest

Posted by Hoa Phan <s5...@gmail.com>.
looks like I can't overwrite the webapp context.xml with tomcat
context.xml. I have no control over the WAR file until tomcat deployed it :(

If I try to use tomcat server.xml and add
<Context>

  <JarScanner scanManifest="false"/>

</Context>

inside <Host> it somehow breaks the webapp.

Is there any other way for me to set this scanmanifest to false.

Says if I took all the jars that I saw reported as
WARNING: Failed to scan...
java.io.FileNotFoundException: .../common/lib/jonas_timer.jar (No such file
or directory)

And append them to:
tomcat.util.scan.StandardJarScanFilter.jarsToSkip

in catalina.properties, would that help ?

On Fri, Mar 10, 2017 at 10:33 AM, Mark Thomas <ma...@apache.org> wrote:

> On 09/03/17 21:38, Hoa Phan wrote:
> > I'll try that and see how it goes, thanks Mark. Btw, when I was
> debugging I
> > couldn't find where this method get called at all:
> >     public void setScanManifest(boolean scanManifest) {
> >         this.scanManifest = scanManifest;
> >     }
> >
> > This props default to true:
> >     private boolean scanManifest = true;
> >
> > And the StandardJarScanner always been constructed like:
> >             jarScanner = new StandardJarScanner();
> >
> > How would scanManifest ever be set to false...
>
> Via the digester when processing server.xml or context.xml. Take a look
> at org.apache.catalina.startup.ContextRuleSet
>
> Mark
>
>
> >
> > Regards,
> >
> > Hoa Phan.
> >
> >
> >
> >
> > On Fri, Mar 10, 2017 at 6:44 AM, Mark Thomas <ma...@apache.org> wrote:
> >
> >> On 09/03/17 13:15, Hoa Phan wrote:
> >>> Hi,
> >>>
> >>> I see that since 8.0.38 we added a scanManifest props to JarScanner.
> >>> But when I added the props
> >>> into: container/tomcat8x/apache-tomcat-8.0.38/conf/context.xml
> >>> <?xml version="1.0" encoding="UTF-8"?>
> >>> <Context>
> >>>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
> >>>     <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
> >>>
> >>>     <!-- Uncomment this to disable session persistence across Tomcat
> >>> restarts -->
> >>>     <!--
> >>>     <Manager pathname="" />
> >>>     -->
> >>>
> >>>     <!-- Uncomment this to enable Comet connection tacking (provides
> >> events
> >>>          on session expiration as well as webapp lifecycle) -->
> >>>     <!--
> >>>     <Valve
> >>> className="org.apache.catalina.valves.CometConnectionManagerValve" />
> >>>     -->
> >>> <JarScanner scanManifest="false" /></Context>
> >>>
> >>> It doesn't work and the prop is still true on startup:
> >>
> >> Hmm. That should work. Are you sure that file is being read at startup?
> >> One way to check is to deliberately break it and see what happens.
> >>
> >> Mark
> >>
> >>
> >>>
> >>> ​
> >>> Must I put this in the context.xml of the webapp itself. I deploy the
> >>> webapp via a war file and have no control over the war content until
> >>> tomcat deploys it which is too late...
> >>>
> >>> Is there any other way for me to turn this off using global config of
> >>> tomcat.
> >>>
> >>> Thanks much.
> >>>
> >>> Regards,
> >>>
> >>> Hoa Phan
> >>>
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: What is the correct way to use scanManifest

Posted by Mark Thomas <ma...@apache.org>.
On 09/03/17 21:38, Hoa Phan wrote:
> I'll try that and see how it goes, thanks Mark. Btw, when I was debugging I
> couldn't find where this method get called at all:
>     public void setScanManifest(boolean scanManifest) {
>         this.scanManifest = scanManifest;
>     }
> 
> This props default to true:
>     private boolean scanManifest = true;
> 
> And the StandardJarScanner always been constructed like:
>             jarScanner = new StandardJarScanner();
> 
> How would scanManifest ever be set to false...

Via the digester when processing server.xml or context.xml. Take a look
at org.apache.catalina.startup.ContextRuleSet

Mark


> 
> Regards,
> 
> Hoa Phan.
> 
> 
> 
> 
> On Fri, Mar 10, 2017 at 6:44 AM, Mark Thomas <ma...@apache.org> wrote:
> 
>> On 09/03/17 13:15, Hoa Phan wrote:
>>> Hi,
>>>
>>> I see that since 8.0.38 we added a scanManifest props to JarScanner.
>>> But when I added the props
>>> into: container/tomcat8x/apache-tomcat-8.0.38/conf/context.xml
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <Context>
>>>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
>>>     <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
>>>
>>>     <!-- Uncomment this to disable session persistence across Tomcat
>>> restarts -->
>>>     <!--
>>>     <Manager pathname="" />
>>>     -->
>>>
>>>     <!-- Uncomment this to enable Comet connection tacking (provides
>> events
>>>          on session expiration as well as webapp lifecycle) -->
>>>     <!--
>>>     <Valve
>>> className="org.apache.catalina.valves.CometConnectionManagerValve" />
>>>     -->
>>> <JarScanner scanManifest="false" /></Context>
>>>
>>> It doesn't work and the prop is still true on startup:
>>
>> Hmm. That should work. Are you sure that file is being read at startup?
>> One way to check is to deliberately break it and see what happens.
>>
>> Mark
>>
>>
>>>
>>> \u200b
>>> Must I put this in the context.xml of the webapp itself. I deploy the
>>> webapp via a war file and have no control over the war content until
>>> tomcat deploys it which is too late...
>>>
>>> Is there any other way for me to turn this off using global config of
>>> tomcat.
>>>
>>> Thanks much.
>>>
>>> Regards,
>>>
>>> Hoa Phan
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 


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


Re: What is the correct way to use scanManifest

Posted by Hoa Phan <s5...@gmail.com>.
I'll try that and see how it goes, thanks Mark. Btw, when I was debugging I
couldn't find where this method get called at all:
    public void setScanManifest(boolean scanManifest) {
        this.scanManifest = scanManifest;
    }

This props default to true:
    private boolean scanManifest = true;

And the StandardJarScanner always been constructed like:
            jarScanner = new StandardJarScanner();

How would scanManifest ever be set to false...

Regards,

Hoa Phan.




On Fri, Mar 10, 2017 at 6:44 AM, Mark Thomas <ma...@apache.org> wrote:

> On 09/03/17 13:15, Hoa Phan wrote:
> > Hi,
> >
> > I see that since 8.0.38 we added a scanManifest props to JarScanner.
> > But when I added the props
> > into: container/tomcat8x/apache-tomcat-8.0.38/conf/context.xml
> > <?xml version="1.0" encoding="UTF-8"?>
> > <Context>
> >     <WatchedResource>WEB-INF/web.xml</WatchedResource>
> >     <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
> >
> >     <!-- Uncomment this to disable session persistence across Tomcat
> > restarts -->
> >     <!--
> >     <Manager pathname="" />
> >     -->
> >
> >     <!-- Uncomment this to enable Comet connection tacking (provides
> events
> >          on session expiration as well as webapp lifecycle) -->
> >     <!--
> >     <Valve
> > className="org.apache.catalina.valves.CometConnectionManagerValve" />
> >     -->
> > <JarScanner scanManifest="false" /></Context>
> >
> > It doesn't work and the prop is still true on startup:
>
> Hmm. That should work. Are you sure that file is being read at startup?
> One way to check is to deliberately break it and see what happens.
>
> Mark
>
>
> >
> > ​
> > Must I put this in the context.xml of the webapp itself. I deploy the
> > webapp via a war file and have no control over the war content until
> > tomcat deploys it which is too late...
> >
> > Is there any other way for me to turn this off using global config of
> > tomcat.
> >
> > Thanks much.
> >
> > Regards,
> >
> > Hoa Phan
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: What is the correct way to use scanManifest

Posted by Mark Thomas <ma...@apache.org>.
On 09/03/17 13:15, Hoa Phan wrote:
> Hi,
> 
> I see that since 8.0.38 we added a scanManifest props to JarScanner.
> But when I added the props
> into: container/tomcat8x/apache-tomcat-8.0.38/conf/context.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <Context>
>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
>     <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
> 
>     <!-- Uncomment this to disable session persistence across Tomcat
> restarts -->
>     <!--
>     <Manager pathname="" />
>     -->
> 
>     <!-- Uncomment this to enable Comet connection tacking (provides events
>          on session expiration as well as webapp lifecycle) -->
>     <!--
>     <Valve
> className="org.apache.catalina.valves.CometConnectionManagerValve" />
>     -->
> <JarScanner scanManifest="false" /></Context>
> 
> It doesn't work and the prop is still true on startup:

Hmm. That should work. Are you sure that file is being read at startup?
One way to check is to deliberately break it and see what happens.

Mark


> 
> \u200b
> Must I put this in the context.xml of the webapp itself. I deploy the
> webapp via a war file and have no control over the war content until
> tomcat deploys it which is too late...
> 
> Is there any other way for me to turn this off using global config of
> tomcat.
> 
> Thanks much.
> 
> Regards,
> 
> Hoa Phan
> 
> 


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