You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2022/09/08 14:10:16 UTC

[Bug 66254] New: The StandardJarScanner extract wrong jar name and cause duplicate jar scan

https://bz.apache.org/bugzilla/show_bug.cgi?id=66254

            Bug ID: 66254
           Summary: The StandardJarScanner extract wrong jar name and
                    cause duplicate jar scan
           Product: Tomcat 10
           Version: 10.0.23
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: keesvandieren@gmail.com
  Target Milestone: ------

We run in a bug similar to https://bz.apache.org/bugzilla/show_bug.cgi?id=65226

The assumption is that this bugfix never made it to Tomcat 9 or Tomcat 10? We
get the same issue in both versions.

This is what we get:

WARNING: Failed to scan
[file:/Users/username/.m2/repository/io/grpc/grpc-netty-shaded/1.39.0/grpc-core-1.39.0.jar]
from classloader hierarchy

Stack trace:

        at
org.apache.tomcat.util.compat.Jre9Compat.jarFileNewInstance(Jre9Compat.java:209)
        at
org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:65)
        at
org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:49)
        at
org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:383)
        at
org.apache.tomcat.util.scan.StandardJarScanner.processURLs(StandardJarScanner.java:318)
        at
org.apache.tomcat.util.scan.StandardJarScanner.doScanClassPath(StandardJarScanner.java:282)
        at
org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:233)
        at
org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:2136)

Tested with Tomcat 10.0.23

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66254] The StandardJarScanner extract wrong jar name and cause duplicate jar scan

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66254

--- Comment #1 from Han Li <li...@apache.org> ---
(In reply to keesvandieren from comment #0)
> We run in a bug similar to
> https://bz.apache.org/bugzilla/show_bug.cgi?id=65226
> 
> The assumption is that this bugfix never made it to Tomcat 9 or Tomcat 10?
> We get the same issue in both versions.

Why do you think the problem you are experiencing is similar to 65226? 
Judging from the stack trace you provided, it's not caused by the same issue.

I think it might be caused by the non-existence of core-1.39.0.jar. please
check if core-1.39.0.jar is there.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66254] The StandardJarScanner extract wrong jar name and cause duplicate jar scan

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66254

keesvandieren@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66254] The StandardJarScanner extract wrong jar name and cause duplicate jar scan

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66254

--- Comment #2 from keesvandieren@gmail.com ---
Hi, thank for your quick reaction.

I have a pointer there: grpc-netty-shaded is a 'fat jar' which means that it
has included (code of) many other jars. The JAR file itself is located here: 
 https://search.maven.org/artifact/io.grpc/grpc-netty-shaded/1.39.0/jar it is 8
MB.

When I configure the StandardJarScanFilter like so, my problem is gone:

    StandardJarScanFilter standardJarScanFilter = new StandardJarScanFilter();
    standardJarScanFilter.setTldSkip("*grpc*.jar");
    standardJarScanFilter.setPluggabilitySkip("*grpc*.jar");
    return standardJarScanFilter;


FYI what I tried to achieve, is to have web-fragments from Maven dependencies
of tomcat-embedded added to my own in-module web.xml while using Embedded
Tomcat. This doesn't work, as the code assumes (correctly) that only webapp
(WEB-INF/lib) jars should be scanned for fragments (assumed by
StandardJarScanner).

I assume GRPC is also manipulating class-loaders, and that is the cause this
issue pops up.

I think you can close the issue, as it is probably caused by some external
class-loaders doing magic with fat-jars. If you still want Tomcat to support
this use-case, I can create reproduction project but I assume it is not Tomcats
fault, so we can close issue.

Thank for your time.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org