Bug 34993 - Missing Class-Path entries are ignored, spec violation
Summary: Missing Class-Path entries are ignored, spec violation
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.9
Hardware: Other other
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-20 21:21 UTC by Tim Shadel
Modified: 2005-06-03 11:34 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Shadel 2005-05-20 21:22:00 UTC
I think this behavior violates the Servlet spec (see below).  If I'm reading it
right, Class-Path entries in the MANIFEST.MF files for *both* WAR files and JAR
files in the WEB-INF/lib must cause the container to reject the application.

From http://jakarta.apache.org/tomcat/tomcat-5.0-doc/changelog.html
Under 5.0.6: 

"Tomcat will now ignore a non existent classpath JAR (remm)"

From servlet-2_4-fr-spec.pdf, 9.7.1:

"The application developer depending on such an extension or extensions must
provide a META-INF/MANIFEST.MF entry in the WAR file listing all extensions
needed by theWAR. The format of the manifest entry should follow standard JAR
manifest format. During deployment of the Web application, the Web container
must make the correct versions of the extensions available to the application
following the rules defined by the Optional Package Versioning mechanism (http:/
/java.sun.com/j2se/1.4/docs/guide/extensions/)."

"Web containers must also be able to recognize declared dependencies
expressed in the manifest entry of any of the library JARs under the WEB-INF/lib
entry in a WAR."

"If a Web container is not able to satisfy the dependencies declared in this
manner, it should reject the application with an informative error message."

-----

I found the bug when Tomcat logged a ClassNotFoundException for a class that is
found in a jar listed in the Class-Path entry for my WAR's manifest.  This jar
should have been placed in the TC_HOME\shared\lib directory, but was overlooked
and not copied there.  It would be helpful if Tomcat rejected the WAR with an
informative error message so that the administrator quickly realized that the
environment was not configured properly.
Comment 1 Remy Maucherat 2005-06-01 11:38:02 UTC
You are confusing regular classpath entries with extensions, which is not
declared the same thing (extension means you want one library with a certain
version or up, it's much more robust than a pointer to a JAR). The servlet spec
does mandate checking for extensions, but obviously you should never be using a
Class-Path entry.

Please do not reopen the report.
Comment 2 Tim Shadel 2005-06-03 19:34:07 UTC
Thanks.  I confused

http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html#bundled

with

http://java.sun.com/j2se/1.4.2/docs/guide/extensions/versioning.html

Now I get the errors I expected:

INFO: Deploying web application archive test-cp.war
Jun 3, 2005 10:31:22 AM org.apache.catalina.util.ExtensionValidator
validateManifestResources
INFO: ExtensionValidator[/test-cp][Web Application Manifest]: Required extension
"com.example.testcp" not found.
Jun 3, 2005 10:31:22 AM org.apache.catalina.util.ExtensionValidator
validateManifestResources
INFO: ExtensionValidator[/test-cp]: Failure to find 1 required extension(s).

Thanks again!