question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tomcat 7, jdbc connections aren't monitored

See original GitHub issue

Hi We have tomcat 7.0.42. I read the manual I don’t understand if our configuration is correct for javamelody “auto-discovery”:

/home/folium/folium-prod/apache-tomcat-7.0.42/conf/context.xml

      <Resource name="jdbc/folium"
      url="jdbc:postgresql://postgresqldb:5432/folium"

/home/folium/folium-prod/local-conf.xml

      <data-service jndi-enabled="true" jndi-position="java:/comp/env/jdbc/folium" />

/home/folium/folium-prod/webapp/WEB-INF/enti/ATSBergamo/data-service-conf.xml

         <jndi-position>java:/comp/env/jdbc/folium</jndi-position>

Questions:

  1. context.xml : is it correct url=“jdbc:postgresql://…” or is it better url=“jdbc://…” ?

  2. local-conf.xml : is it correct jndi-position=“java:/comp/…” or is it better jndi-position=“java:comp/…”

  3. should I add this java parameter ? -Djavamelody.datasources=java:comp/env/jdbc/folium

Best regards, Sala

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
massimosalacommented, Oct 13, 2020

I added the listener to the start of the web.xml, as suggested, and now the reports are OK. Many thanks for your support.

0reactions
massimosalacommented, Oct 8, 2020

And since you have <data-service jndi-enabled="true" jndi-position="java:/comp/env/jdbc/folium" /> in a local-conf.xml file, perhaps you have a servlet listener that is getting and caching the datasource from JNDI before the initialization of javamelody in the javamelody SessionListener. In that case, it may help that the following listener is written in your WEB-INF/web.xml file before your servlet listener :

	<listener>
		<listener-class>net.bull.javamelody.SessionListener</listener-class>
	</listener>

Yes, we have this file /home/folium/folium-prod/webapp/WEB-INF/web.xml but it doesn’t list any listener, so I don’t know if / how to modify it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apache Tomcat 7 (7.0.109) - The Tomcat JDBC Connection Pool
You can use interceptors to gather query stats, cache session states, reconnect the connection upon failures, retry queries, cache query results, and so...
Read more >
monitor JDBC connections - tomcat - Stack Overflow
I am trying to monitor JDBC connections in tomcat using JMX. But it is giving information only regarding the Datasource resources, ...
Read more >
Monitor Tomcat-JDBC connections - java - Server Fault
Monitoring the Tomcat containers is simple using Nagios. The problem is that the front page of the site will show up but the...
Read more >
How to Monitor a Tomcat JDBC Connection pool from a ...
With this example you can find out the active, idle connections, etc. from a tomcat connection pool. This is very useful to know...
Read more >
Unable to view jdbc connections and sql hits for tomcat jdbc ...
My App has tomcat jdbc connection pool deployed over tomcat 7 .I am unable to view the jdbc ... <filter-name>monitoring</filter-name>.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found