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 2016/08/23 14:09:01 UTC

[Bug 60033] New: Jar scanning not handling properly Manifest class-path attribute

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

            Bug ID: 60033
           Summary: Jar scanning not handling properly Manifest class-path
                    attribute
           Product: Tomcat 8
           Version: 8.5.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Util
          Assignee: dev@tomcat.apache.org
          Reporter: kineolyan@gmail.com

Running tomcat 8.5.4 on a maven project with various jars, I ended up with a
lot of errors like:
> WARNING: Failed to scan [file:/home/olivier/maven/repo/net/sf/jung/jung-graph-impl/2.0.1/jung-api-2.0.1.jar] from classloader hierarchy
> java.io.FileNotFoundException: /home/olivier/maven/repo/net/sf/jung/jung-graph-impl/2.0.1/jung-api-2.0.1.jar (No such file or directory)
> ... (stacktrace)

After some debugging, I discovered that it occurs for jars having a Manifest
file with a non-empty Class-Path attribute.

For example, jung-graph-impl-2.0.1.jar MANIFEST defines Class-Path as:
> Class-Path: jung-api-2.0.1.jar collections-generic-4.01.jar
With that, the code
(org.apache.tomcat.util.scan.StandardJarScanner#processManifest) tries to load
the jars as if located in the same directory, resulting in requests for
/home/olivier/maven/repo/net/sf/jung/jung-graph-impl/2.0.1/jung-api-2.0.1.jar,
which does not exist.
Indeed, following maven guidelines, it is located in
/home/olivier/maven/repo/net/sf/jung/jung-api/2.0.1/jung-api-2.0.1.jar.

As I am not familiar with MANIFEST, I don't know if the error comeo from a
badly defined MANIFEST, or if the manifest can reference jars outside this jar.

If Issue 59961 was complete, I could have skipped Manifest, as I don't need
them.

Thanks for the reply

-- 
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 60033] Jar scanning not handling properly Manifest class-path attribute

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

Mark Thomas <ma...@apache.org> changed:

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

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Bugzilla is not a support forum. Use the users mailing list.

-- 
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 60033] Jar scanning not handling properly Manifest class-path attribute

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

--- Comment #2 from Olivier Peyrusse <ki...@gmail.com> ---
(In reply to Mark Thomas from comment #1)
> Bug 59961 does look as if it would be useful to you. Patches (attached to
> that bug) welcome.
As stated by my comment, I read that task for improvement, but saw no
attachement. As suggested by the comment, I was also investigating the usage of
JarScanFilter.

However, I have another question for you. Does the Manifest processing works
for Tomcat in its embedded version ?
When my issue occurs, the server I have was created by instanciated a Tomcat
class
(https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/startup/Tomcat.html),
as well as no web.xml but instead WebAppInitializer class.

In its application version, a WAR is loaded, containing in the lib folder all
jars. Thus, looking for jars referenced by the Manifest in the same folder as
the jar itself seems logical.
This is different in my case, where the server is created from the main method,
because the classpath of the program is made from several locations.

If I reuse my example with jung-graph, it gives me:
E.g. java -cp
/home/olivier/maven/repo/net/sf/jung/jung-api/2.0.1/jung-api-2.0.1.jar;/home/olivier/maven/repo/net/sf/jung/jung-graph-impl/2.0.1/jung-graph-impl-2.0.1.jar
MyMainClass

In this case, jung-api-2.0.1.jar is indeed in the classpath, but not in the
same folder as jung-graph-impl-2.0.1.jar.

Maybe I am misusing the Tomcat class, but I heavily looked for a documentation
or tutorial on how to use it, and found very few.

Regards

-- 
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 60033] Jar scanning not handling properly Manifest class-path attribute

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

Olivier Peyrusse <ki...@gmail.com> changed:

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

--- Comment #3 from Olivier Peyrusse <ki...@gmail.com> ---
Marking the issue as reopened to get an answer on my latest question.
Otherwise, I think the issue is skipped.

Regards

-- 
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 60033] Jar scanning not handling properly Manifest class-path attribute

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

Mark Thomas <ma...@apache.org> changed:

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

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
(In reply to Olivier Peyrusse from comment #0)

> As I am not familiar with MANIFEST, I don't know if the error comeo from a
> badly defined MANIFEST, or if the manifest can reference jars outside this
> jar.

It is generally a good idea to do a little research before raising a bug. [1]
would have been informative.

Bug 59961 does look as if it would be useful to you. Patches (attached to that
bug) welcome.

[1]
https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#classpath

-- 
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