lemonzone2010 / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

JDBC and SQL stats not collecting #306

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install 1.44 and j-robin 1.5.9.1
2. Update web.xml for specific app
3. Restart Tomcat 6
4. browse to ../monitoring

What is the expected output? What do you see instead?
I am seeking JDBC and SQL stats

What version of the product are you using? On what application server, JDK,
operating system?
Tomcat 6, JDK 1.6, Win Srv 2008 Std

Please provide any additional information below.
All the stats are working as expected, except for JDBC and SQL.
Latest debugging log:
Fri May 03 01:18:43 CDT 2013     DEBUG     JavaMelody listener init started
Fri May 03 01:18:43 CDT 2013     DEBUG     datasources found in JNDI: 
[java:comp/env/jdbc/mobiledocDb, java:comp/env/jdbc/multumDb]
Fri May 03 01:18:43 CDT 2013     DEBUG     datasource rebinded: 
java:comp/env/jdbc/mobiledocDb from class 
org.apache.tomcat.dbcp.dbcp.BasicDataSource to class $Proxy0
Fri May 03 01:18:43 CDT 2013     DEBUG     datasource rebinded: 
java:comp/env/jdbc/multumDb from class 
org.apache.tomcat.dbcp.dbcp.BasicDataSource to class $Proxy0
Fri May 03 01:18:43 CDT 2013     DEBUG     JavaMelody listener init done in 187 
ms
Fri May 03 01:18:43 CDT 2013     DEBUG     JavaMelody filter init started
Fri May 03 01:18:43 CDT 2013     DEBUG     OS: Windows Server 2008 Service Pack 
2, amd64/64
Fri May 03 01:18:43 CDT 2013     DEBUG     Java: Java(TM) SE Runtime 
Environment, 1.6.0_10-b33
Fri May 03 01:18:43 CDT 2013     DEBUG     Server: Apache Tomcat/6.0.18
Fri May 03 01:18:43 CDT 2013     DEBUG     Webapp context: /mobiledoc
Fri May 03 01:18:43 CDT 2013     DEBUG     JavaMelody version: 1.44.0
Fri May 03 01:18:43 CDT 2013     DEBUG     JavaMelody classes loaded from: 
file:/C:/eClinicalWorks/tomcat6/webapps/mobiledoc/WEB-INF/lib/javamelody.jar
Fri May 03 01:18:43 CDT 2013     DEBUG     Host: CHFM-SRVR-PRD@172.16.4.101
Fri May 03 01:18:43 CDT 2013     DEBUG     log listeners initialized
Fri May 03 01:18:43 CDT 2013     DEBUG     datasources found in JNDI: 
[java:comp/env/jdbc/mobiledocDb, java:comp/env/jdbc/multumDb]
Fri May 03 01:18:44 CDT 2013     DEBUG     job global listener initialized
Fri May 03 01:18:44 CDT 2013     DEBUG     counters initialized
Fri May 03 01:18:44 CDT 2013     DEBUG     counters data read from files in 
C:\eClinicalWorks\tomcat6\temp\javamelody\mobiledoc_CHFM-SRVR-PRD
Fri May 03 01:18:44 CDT 2013     DEBUG     collect task scheduled every 60s
Fri May 03 01:18:47 CDT 2013     DEBUG     first collect of data done
Fri May 03 01:18:47 CDT 2013     DEBUG     JavaMelody filter init done in 3229 
ms

Original issue reported on code.google.com by pgodf...@gmail.com on 3 May 2013 at 4:06

GoogleCodeExporter commented 9 years ago
According to the debugging logs, 2 datasources are correctly monitored.
So you probably lookup and keep the datasources before that they are changed 
for the monitoring.

How do you lookup the datasources?
Do you use Spring for example?

Original comment by evernat@free.fr on 3 May 2013 at 10:14

GoogleCodeExporter commented 9 years ago
Thanks for the response, this is a vendor product - I don't have access to code 
details (without de-compiling).
Where would I find the answer you are looking for?
I don't know if the app uses Spring.
pg

Original comment by pgodf...@gmail.com on 5 May 2013 at 3:23

GoogleCodeExporter commented 9 years ago
You may find the answer to how is the lookup of the datasources, if you find 
the datasources inside a hibernate.cfg.xml file (if Hibernate) or inside 
something like a application context xml file (if Spring), both inside the war 
file of the webapp (which is a simple zip file).
Or the datasources may be looked up by "new 
InitialContext().lookup("java:comp/env/jdbc/mobiledocDb") inside the code.

But given that you don't know much how the datasources are looked up, I suggest 
to try an undocumented parameter: javamelody.rewrap-datasources
It may or may not work in your particular case and is not officially supported, 
but I think that it is worth a try.

So you can add a system property when starting Tomcat: 
-Djavamelody.rewrap-datasources=true
or in conf/catalina.properties of Tomcat: javamelody.rewrap-datasources=true 
(without -D)

After restarting the server, please copy in this issue the new debugging logs, 
and use your webapp a bit to see if SQL stats are displayed in the reports.

Original comment by evernat@free.fr on 8 May 2013 at 9:08

GoogleCodeExporter commented 9 years ago
Very good - I will look for the code details, but I suspect that will be 
educational only, as I cannot change said code.
I will work on the rewrap approach and update this issue in a few days.
thanks very much
pg

Original comment by pgodf...@gmail.com on 8 May 2013 at 2:40

GoogleCodeExporter commented 9 years ago
Same problem here. We have a jboss 6 setup and after upgrading to java melody 
1.44 from 1.37 we lost jdbc statistics.  

Original comment by jordi.pu...@gmail.com on 8 May 2013 at 2:48

GoogleCodeExporter commented 9 years ago
Gave it a try - doesn't seem to work.
Wed May 08 20:25:20 CDT 2013     DEBUG     JavaMelody listener init started
Wed May 08 20:25:20 CDT 2013     DEBUG     datasources found in JNDI: 
[java:comp/env/jdbc/mobiledocDb, java:comp/env/jdbc/multumDb]
Wed May 08 20:25:20 CDT 2013     DEBUG     Datasource needs rewrap: 
java:comp/env/jdbc/mobiledocDb of class 
org.apache.tomcat.dbcp.dbcp.BasicDataSource
Wed May 08 20:25:20 CDT 2013     DEBUG     rebinding datasources failed, 
skipping
Wed May 08 20:25:20 CDT 2013     DEBUG     JavaMelody listener init done in 172 
ms
Wed May 08 20:25:20 CDT 2013     DEBUG     JavaMelody filter init started
Wed May 08 20:25:20 CDT 2013     DEBUG     OS: Windows Server 2008 Service Pack 
2, amd64/64
Wed May 08 20:25:20 CDT 2013     DEBUG     Java: Java(TM) SE Runtime 
Environment, 1.6.0_10-b33
Wed May 08 20:25:20 CDT 2013     DEBUG     Server: Apache Tomcat/6.0.18
Wed May 08 20:25:20 CDT 2013     DEBUG     Webapp context: /mobiledoc
Wed May 08 20:25:20 CDT 2013     DEBUG     JavaMelody version: 1.44.0
Wed May 08 20:25:20 CDT 2013     DEBUG     JavaMelody classes loaded from: 
file:/C:/eClinicalWorks/tomcat6/webapps/mobiledoc/WEB-INF/lib/javamelody.jar
Wed May 08 20:25:20 CDT 2013     DEBUG     Host: CHFM-SRVR-PRD@172.16.4.101
Wed May 08 20:25:20 CDT 2013     DEBUG     parameter defined: 
rewrap-datasources=true
Wed May 08 20:25:20 CDT 2013     DEBUG     log listeners initialized
Wed May 08 20:25:20 CDT 2013     DEBUG     datasources found in JNDI: 
[java:comp/env/jdbc/mobiledocDb, java:comp/env/jdbc/multumDb]
Wed May 08 20:25:20 CDT 2013     DEBUG     Datasource needs rewrap: 
java:comp/env/jdbc/mobiledocDb of class 
org.apache.tomcat.dbcp.dbcp.BasicDataSource
Wed May 08 20:25:20 CDT 2013     DEBUG     rebinding datasources failed, 
skipping
Wed May 08 20:25:20 CDT 2013     DEBUG     job global listener initialized
Wed May 08 20:25:20 CDT 2013     DEBUG     counters initialized
Wed May 08 20:25:20 CDT 2013     DEBUG     counters data read from files in 
C:\eClinicalWorks\tomcat6\temp\javamelody\mobiledoc_CHFM-SRVR-PRD
Wed May 08 20:25:20 CDT 2013     DEBUG     collect task scheduled every 60s
Wed May 08 20:25:24 CDT 2013     DEBUG     first collect of data done
Wed May 08 20:25:24 CDT 2013     DEBUG     JavaMelody filter init done in 3775 
ms

Original comment by pgodf...@gmail.com on 9 May 2013 at 3:44

GoogleCodeExporter commented 9 years ago
Sorry for the delay, I was on other horses.

The log in your last comment says:
... Datasource needs rewrap: java:comp/env/jdbc/mobiledocDb of class 
org.apache.tomcat.dbcp.dbcp.BasicDataSource
... rebinding datasources failed, skipping
So the "rewrap" does not seem to work.

Strange, except if one of the two databases was not available.
Are you sure that the two datasources (java:comp/env/jdbc/mobiledocDb, 
java:comp/env/jdbc/multumDb) were able to connect to the databases?

Original comment by evernat@free.fr on 8 Jul 2013 at 5:25

GoogleCodeExporter commented 9 years ago
Just in case my previous comment was right, and when rewraping the datasources, 
one was unavailable, I have committed a change in revision 3463 (will be 
released in v1.47.0).

Do you have any news on your side about this? Can we close the issue as fixed 
or incomplete?

Original comment by evernat@free.fr on 9 Aug 2013 at 10:05

GoogleCodeExporter commented 9 years ago
I'll try it out and let you know in a few days...
pg

Original comment by pgodf...@gmail.com on 12 Aug 2013 at 12:59

GoogleCodeExporter commented 9 years ago
I could not find the DB stats. 
I am using spring jpa with hibernate has jpa vendor adapter.

I have added 

<property name="jpaPropertyMap">
            <map>                               
                <entry key="hibernate.connection.driver_class" value="net.bull.javamelody.JdbcDriver" />
            </map>
        </property>
to org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.

did I add at wrong place? not sure. But i could not find DB stats.
Thanks in advance.

Original comment by anilk...@gmail.com on 17 Aug 2013 at 3:18

GoogleCodeExporter commented 9 years ago
@pgodrin
No news, so resolving as invalid/incomplete (or perhaps it was fixed as said 
above).

Original comment by evernat@free.fr on 13 Oct 2013 at 9:20

GoogleCodeExporter commented 9 years ago
It was in fact @pgodfrin

Original comment by evernat@free.fr on 13 Oct 2013 at 9:21