Take a look at how the ManagerServlet lists resources:

https://github.com/apache/tomcat/blob/main/java/org/apache/catalina/manager/ManagerServlet.java#L1193

Hopefully that will give you some pointers.

Mark


On 22/11/2022 14:56, Rob Sargent wrote:
I trying to get the list of available db resources to send to a web page.   My context.xml file below is generated at startup since the user(s) and dbs change regularly and I would like to see "who's on first" from my monitor servlet.  I tried context.getEnvironment() but that's empty.  Is there programmatic access t the list of Resource names?

    <Context reloadable="true">

    <Resource
         name="jdbc/sgsdb/chpc-ver4024"
    url="jdbc:postgresql://gitanmax:5432/ver4024?prepareThreshold=0"
         driverClassName="org.postgresql.Driver"
         type="javax.sql.DataSource"
         factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
         testWhileIdle="false"
         testOnBorrow="true"
         testOnReturn="false"
         validationInterval="30000"
         validationQuery="select 1"
         timeBetweenEvictionRunsMillis="30000"
         maxActive="50"
         initialSize="3"
         maxWait="10000"
         removeAbandonedTimeout="3600"
         removeAbandoned="true"
         minEvictableIdleTimeMillis="30000"
         minIdle="1"
         maxIdle="5"
         logAbandoned="true"
         username="chpc"
         />

    <Resource
         name="jdbc/sgsdb/v24-ver4024"
    url="jdbc:postgresql://gitanmax:5432/ver4024?prepareThreshold=0"
         driverClassName="org.postgresql.Driver"
         type="javax.sql.DataSource"
         factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
         testWhileIdle="false"
         testOnBorrow="true"
         testOnReturn="false"
         validationInterval="30000"
         validationQuery="select 1"
         timeBetweenEvictionRunsMillis="30000"
         maxActive="50"
         initialSize="3"
         maxWait="10000"
         removeAbandonedTimeout="3600"
         removeAbandoned="true"
         minEvictableIdleTimeMillis="30000"
         minIdle="1"
         maxIdle="5"
         logAbandoned="true"
         username="v24"
         />

       <Valve
           className="org.apache.catalina.valves.AccessLogValve"
           prefix="sgs_access"
           directory="${SGSSRVR_AccessLogDir}"
           maxDays="7">
       </Valve>
    </Context>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to