How do I read the manifest file for a webapp running in apache tomcat?

Maybe your side-effects come from the fact that almost all jars include a MANIFEST.MF and you’re not getting the right one. To read the MANIFEST.MF from the webapp, I would say:

ServletContext application = getServletConfig().getServletContext();
InputStream inputStream = application.getResourceAsStream("/META-INF/MANIFEST.MF");
Manifest manifest = new Manifest(inputStream);

Please note that running Tomcat from Eclipse is not the same as running Tomcat alone as Eclipse plays with the classloader.

Leave a Comment