I am writing a Web application with Java, and this WAR application may be deployed to different application servers, such as Tomcat/JBoss/Jetty/Weblogic.
These type of information are always put in some MBean. Please check out the respect ive App Server's documentation about the MBeans the provide. You can programmatically access the MBean using JMX APIs.