tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Odnert <dodn...@postpath.com>
Subject Servlet Access To Its Package Version
Date Thu, 26 Apr 2007 17:09:34 GMT
Let me start by explaining that my goal is to have a Java servlet log its
implementation version number when it is loaded and initialized by
Tomcat.  I am having trouble with my current approach.  I would appreciate
responses that help me to fix my current approach, or offer alternative
approaches to achieving the high level goal.
 
Current approach: My .war file includes a META-INF/MANIFEST.MF
file that looks like this:
 
  Manifest-Version: 1.0
  Ant-Version: Apache Ant 1.6.5
  Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
 
  Name: com/postpath/services/
  Specification-Title: PostPath Services
  Specification-Version: 3.0.0
  Specification-Vendor: PostPath, Inc.
  Package-Title: com.postpath.services
  Package-Version: 3.0.0.0704250115
  Package-Vendor: PostPath, Inc.
 
My servlet class is defined in package com.postpath.services and
the .class files are located in WEB-INF/classes/com/postpath/services/.
However, when my servlet initialization function is called, I get a null
String reference returned from this expression:
 
  String versionId = getClass().getPackage().getImplementationVersion();
 
Does anyone know why this might be the case or what I can do to fix this?
 
I am using Tomcat v5.5.7 on JVM 1.5.0_06-b05 from Sun Microsystems
on a Linux OS.  I have already done some Web searching and have
searched the archives of the tomcat-user list, but have been unsuccessful
in locating a working solution.
 
Daryl Odnert
PostPath, Inc.
Mountain View, California

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message