How would I get the ip address(es)
that glassfish is running on within
the web application?
You can get such information in ServletRequest
, e.g. the port.
I would like to also take a snapshot
of the configuration, JDBC
connections, JMS, JNDI, etc. Is this
possible?
You will need to rely on the metadata of the connection or the connection factory. If fear this is not entirely portable, but you should be able to get some information, e.g. the JDBC metadata.
You can also connect the JMX beans of Glassfish. I did that once from a web app to monitor the connection that were allocated over time. If you know the name of the JMX beans to look up (e.g. if you know the name of the data source) you can get a wagon on information there. Basically everything that the native Glassfish console display is there.
You could maybe gather all the information at startup-up withing a ServletContextListener
and then store them somewhere to spit them out in case of an exception.
Note that you can disclose potential sensitive information to the end-user, which is not a recommended practice.