You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Pravallika Peddi <re...@gmail.com> on 2015/04/08 11:58:22 UTC

Re: Reg: Bug 56438

Hi Mark,

Currently there is no mechanism to skip the JARs from Pluggability scan in
Tomcat 8.0.

Below are the fix details that i propose for *tomcat 8* pluggability scan
problem:



1)      Added below code in
org.apache.tomcat.util.descriptor.web.FragmentJarScannerCallBack.java  à

                private boolean fragmentFoundInJar = false;



      In scan methods of this calls setting this variable to true when
needed and if JAR       does not has any fragments added a message:

      *if(!fragmentFoundInJar){*

*        log.info
<http://log.info>(Localizer.getMessage("jspc.warning.NoFragmentInFile",
                                       fragmentFile.getAbsolutePath()));*

*      }*




Added below method to retrieve this value:

*public* *boolean* scanFoundNoFragments(){

            *return* !fragmentFoundInJar;

      }





2)      We are doing fragment scan in two locations:



*First:*

Org.apache.catalina.startup.ContextConfig.java  à
processJarsForWebFragments(WebXml
application)

                Highlighted text is the Fix:



  FragmentJarScannerCallback callback =

                *new* FragmentJarScannerCallback(webXmlParser, delegate,
parseRequired);



        jarScanner.scan(JarScanType.*PLUGGABILITY*,

                context.getServletContext(), callback);



        *boolean* scanFoundNoFrag = callback.scanFoundNoFragments();

        *if*(!callback.scanFoundNoFragments()){

            *log*.info(Localizer.*getMessage*(
"jspc.warning.NoFragmentSummary"));

        }



        *if* (!callback.isOk()) {

            ok = *false*;

        }



*      Second:*

      Org.apache.jasper.servlet.JspCServletContext.java  à
scanForFragments(WebXmlParser
webXmlParser)

      Highlighted text is the fix:

      FragmentJarScannerCallback callback =

                *new* FragmentJarScannerCallback(webXmlParser, *false*,
*true*);

        scanner.scan(JarScanType.*PLUGGABILITY*, *this*, callback);



        *if*(!callback.scanFoundNoFragments()){

            log(Localizer.*getMessage*("jspc.warning.NoFragmentSummary"));

        }



        *if* (!callback.isOk()) {

            *throw* *new* JasperException(Localizer.*getMessage*(
"jspc.error.invalidFragment"));

        }



I tested the changes and the Jars mentioned under
"tomcat.util.scan.StandardJarScanFilter.jarsToSkip"
are getting skipped from both pluggability and tld scans.


Attached the changed classes for review.


For *Tomcat7* related changes, i will send another email.

On Sun, Mar 29, 2015 at 4:07 AM, Mark Thomas <ma...@apache.org> wrote:

> On 26/03/2015 13:27, Pravallika Peddi wrote:
>
> <snip/>
>
> > 1)     As mentioned in bug, in Tomcat7.0 catalina.properties file first 4
> > default jars(except jdom.jar) are missing:
> >   commons-discovery-*.jar,commons-el-*.jar,commons-net-*.jar
> >
> >          We can add them under
> > “tomcat.util.scan.DefaultJarScanner.jarsToSkip”
>
> jdom.jar isn't covered by the existing filters.
>
> <snip/>
>
> > 3)       3)      So I am planning to provide a fix as below for Tomcat
> 7.0
> > TLD scan:
>
> Looks OK so far.
>
> <snip/>
>
> > But in Tomcat 7.0, StandardJarScanner.scan  method only called from both
> > TldConfig.java and ContextConfig.java. So I am afraid I cannot add the
> > Summary message in Tomcat7.0. When User enables FINE  level then only
> they
> > can see the noTldInJar messages
>
> Look again. It certainly is possible to add the summary message for TLDs
> in Tomcat 7.
>
> > 4) Tomcat7.0 ContextConfig scan is taking less time, hence I feel we can
> > ignore it for now.
>
> I disagree. The pluggability scanning can add a significant start-up
> delay to web applications. The reason that the bug report was opened in
> the first place is the time taken for the pluggability scans.
>
> > Please let me know your opinion.
>
> I think you have some more research to do.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>