gstackoverflow
gstackoverflow

Reputation: 37034

How to force javamelody monitor jdbc?

I try to use java melody in my application.

I did following:

  1. added maven dependency:

  2. added filter :

    web.xml:

<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
    <filter-name>javamelody</filter-name>
    <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
    <init-param>
        <param-name>monitoring-path</param-name>
        <param-value>/admin/monitoring</param-value>
    </init-param>
</filter>

session factory configuration looks like this:

<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="configLocation">
        <value>classpath:hibernate-test.cfg.xml</value>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.connection.driver_class">net.bull.javamelody.JdbcDriver</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.connection.charSet">UTF-8</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.format_sql">true</prop>
            <prop key="hbm2ddl.auto">create-drop</prop>
        </props>
    </property>
</bean>

According IDE highliting - this row

<prop key="hibernate.connection.driver_class">net.bull.javamelody.JdbcDriver</prop>

is wrong.

In menu I don't see information about jdbc:

enter image description here

How to explain java melody to monitor jdbc ?

Upvotes: 3

Views: 3673

Answers (1)

Jose Carvajal
Jose Carvajal

Reputation: 151

You need to set also the hibernate.connection.driver property. For example for Oracle:

<props>
    <prop key="hibernate.connection.driver_class">net.bull.javamelody.JdbcDriver</prop>
    <prop key="hibernate.connection.charSet">UTF-8</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.format_sql">true</prop>
    <prop key="hbm2ddl.auto">create-drop</prop>
    <prop key="hibernate.connection.driver">oracle.jdbc.OracleDriver</prop>
</props>

Upvotes: 1

Related Questions