No SQL stats on JavaMelody - JBoss EAP 7

749 views Asked by At

I have a maven application running on JBoss EAP 7.2 . Below details:

  • Build: Maven 3.6
  • Server: JBoss EAP 7.2
  • Java: OpenJDK 11
  • JavaMelody Core: 1.83.0
  • Package: EAR
  • Application: Struts 2.5.22
  • DB: Oracle 18c
  • OJDBC Driver: 18.3

Although I managed to configure JavaMelody and see the main statistics, I can't seem to find a way to configure the SQL monitoring.

Currently, for my JDBC configuration I use the <jta-data-source>java:jboss/datasources/myDS</jta-data-source> in my persistence.xml file, which reads the datasource from the standalone.xml of the JBoss server.

I have tried several changes in my persistence.xml file like adding:

<property name="net.bull.javamelody.jpa.provider" value="org.hibernate.jpa.HibernatePersistenceProvider" />

or

<property name="hibernate.connection.driver_class" value="net.bull.javamelody.JdbcDriver"/>

My struts.xml configuration:

<package name="myApp" extends="struts-default">
    <interceptors>
        <interceptor name="monitoring" class="net.bull.javamelody.StrutsInterceptor"/>
        <interceptor-stack name="myAppStack">
            <interceptor-ref name="monitoring"/>
            <interceptor-ref name="prepare"/>
            ...
            <interceptor-ref name="json"/>
            <interceptor-ref name="debugging"/>
            <interceptor-ref name="defaultStack"/>
        </interceptor-stack>
    </interceptors>
    <default-interceptor-ref name="myAppStack"/>
</package>

or even configuring my datasource entirely in the persistence file using the hibernate.connection.url/username/password properties, but with no luck.

I tried to following the instructions found here, but I can't seem to find what is wrong:

Note: In my persistence.xml I was using also <property name="hibernate.connection.driver" value="oracle.jdbc.OracleDriver" /> . I am not sure if this is somehow conflicting.

1

There are 1 answers

4
evernat On BEST ANSWER

JPA monitoring is completely different than SQL monitoring: do not try net.bull.javamelody.jpa.provider to monitor SQL. And it is useless to try hibernate.connection.driver_class if you use a datasource from JNDI.

For SQL monitoring, you can try to monitor SQL from the datasource in JNDI:

  • either add a javamelody parameter datasource, for example with a system property: -Djavamelody.datasources=java:jboss/datasources/myDS
  • or rename your datasource to java:jdbc/myDS

Then check the "Debugging logs" at the bottom of the javamelody reports.

And because you are using an EAR, see https://github.com/javamelody/javamelody/wiki/UserGuideAdvanced#setup-javamelody-in-an-ear-file