Issue
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.
For diagnostic purpose, I'd like to implement a dynamic web page to collect various environment/system information so that customer can provide these information to support engineers for diagnostics.
One piece of information that is useful is the application server name and version that this application gets deployed to, such as Tomcat 7.0
, JBoss 5.1.0
, Glassfish 3.0
, etc.
I just wonder if there is any standard way to retrieve application server's name and version from different JEE application servers.
Solution
I have find some code for getting server information of where you deploy your application.
This code is written in Servlet to get server info in which it is running..
String str1 = getServletContext().getServerInfo();
By this you will get the server name and the server's version info.
I think it will some what help you..
Answered By - Yagnesh Agola
Answer Checked By - Mary Flores (JavaFixing Volunteer)