Re: [javamelody] javamelody 1.41 monitor JDBC also is zero

163 views
Skip to first unread message

Vernat Emeric

unread,
Oct 7, 2012, 6:10:01 PM10/7/12
to javam...@googlegroups.com
Him

Because you use a datasource from Spring, you can certainly use the monitoring-spring.xml file as said in the user guide, in order to monitor your jdbc connections and sql requests.

To use monitoring-spring.xml, you can write in you web.xml file:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:net/bull/javamelody/monitoring-spring.xml
classpath:applicationContext_*.xml
</param-value>
</context-param>

instead of

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext_*.xml
</param-value>
</context-param>

That's it!
Emeric


Le 06/10/2012 11:07, cheng a écrit :
Hi,I have a problem with JDBC when I use javamelody. I find it can't monitor JDBC. JDBC also is zero.
system info :
rhel 5.5 x64
tomcat 6.0
javamelody : javamelody-1.41.0
Database: oracle 11g
driver_class:com.mchange.v2.c3p0.ComboPooledDataSource




my web.xml is :
<!-- 初始化 Spring classpath*:spring/applicationContext-*.xml,-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext_*.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Javamelody应用监控Listener-->
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
<!--应用监控-->
<filter>
<filter-name>monitoring</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<init-parm>
<parm-name>no-database</parm-name>
<parm-value>false</parm-value>
</init-parm>
<init-param>
<param-name>system-actions-enabled</param-name>
<param-value>true</param-value>
</init-param>
# cat applicationContext_core.xml
<bean id="ds" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${core.driverClassName}" />
<property name="jdbcUrl" value="${core.url}" />
<property name="user" value="${core.username}" />
<property name="password" value="${core.password}" />
<property name="initialPoolSize" value="5"/>
<property name="maxStatements" value="0"/>
<property name="maxPoolSize" value="800"/>
<property name="maxIdleTime" value="600"/>
<property name="automaticTestTable" value="c3p0_test"/>
<property name="idleConnectionTestPeriod" value="60"/>
</bean>
I don't know why JDBC is zero. thanks !
 

Reply all
Reply to author
Forward
0 new messages