Greetings,

I have a need to get version information for classes that I have been
packaged in a war, and loaded into Tomcat 7.0.trunk on Windows 7. For
example:


System.out.println(this.getClass().getPackage().getImplementationVersion());

Assuming my.war/META-INF/MANIFEST.MF:
  Manifest-Version: 1.0
  Implementation-Version: 1.0

getImplementationVersion() always returns null.

If I review the code for WebappClassLoader the reason for this is clear.
All roads lead to findResourceInternal(File, String), line 2983 in
7.x/trunk. This method makes no attempt to load the manifest from the war.

My first instinct was that this is a bug. However, I did a quick check
using the same scenario using Wildfly 8 and the behavior is the same. Given
the clarity of the Tomcat code, and that two robust, well-tested platforms
behave the same, I have to assume this is intentional.

My question is this: why? Is META-INF/MANIFEST.MF not part of the war
standard? I've googled, but am not enough of a java standards wonk to know
what docs are authoritative on this topic. I've certainly seen examples
that use it.

Thanks in advance,
  -- m.

Reply via email to