2015-08-31 33 views
2

我嘗試在我的應用程序中使用java旋律。如何強制javamelody monitor jdbc?

我以下:

  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 highliting - 此行

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

是錯誤的。

在菜單中我沒有看到有關JDBC的信息:

enter image description here

如何解釋Java的旋律監控JDBC?

回答

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>