javajpastruts2jboss-eap-7java-melody

No SQL stats on JavaMelody - JBoss EAP 7


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

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.


Solution

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

    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