How can we find out the number of ServletContext currently active in a servlet container?
No, there are no references in the specifications for that.
As far as I know there is nothing available for that, especially if you need something that is portable or not server specific.
If you have the source code of the server, it is probably trivial (well, depend how documented is the code) to write something, otherwise you need to find alternative solution (like reading and analizing the server configuration files).
But, again, this would be a server specific solution.