【问题标题】:How to force javamelody monitor jdbc?如何强制javamelody监控jdbc?
【发布时间】:2015-11-25 11:57:55
【问题描述】:

我尝试在我的应用程序中使用 java melody。

我做了以下:

  1. 添加了maven依赖:

  2. 添加过滤器:

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>

会话工厂配置如下所示:

<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>

根据 IDE 高亮显示 - 此行

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

错了。

在菜单中我没有看到有关 jdbc 的信息:

如何解释java melody监控jdbc?

【问题讨论】:

    标签: java spring jdbc java-melody process-monitoring


    【解决方案1】:

    您还需要设置“hibernate.connection.driver”属性。以 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>
    

    【讨论】:

      猜你喜欢
      • 2018-06-26
      • 2017-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-23
      • 2012-12-12
      相关资源
      最近更新 更多