Announcement Announcement Module
Collapse
No announcement yet.
Hibernate statistics with JPA Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate statistics with JPA

    I'm trying to wire the Statistics Service but I'm encountering some problems along the way. I've configured it this way:
    Code:
    <bean id="statisticsExporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
            <property name="beans">
                <map>
                    <entry key="Hibernate:name=statistics" value-ref="hibernateStatistics"/>
                </map>
            </property>
        </bean>
    
        <bean id="hibernateStatistics" class="org.hibernate.jmx.StatisticsService">
            <property name="statisticsEnabled" value="true" />
        </bean>
    I cannot provide a session factory to the bean as I don't have one defined (using JPA EntityManagers and JTA). The service is not appearing using Jconsole and connecting to weblogic (IIOP). The log shows the following lines:
    Code:
    [org.springframework.jmx.export.MBeanExporter] - <Registering beans for JMX exposure on startup>
    [org.springframework.util.ClassUtils] - <Class [javax.management.MXBean] or one of its dependencies is not present: java.lang.ClassNotFoundException: javax.management.MXBean>
    [org.springframework.jmx.support.JmxUtils] - <Found MBeanServer: com.sun.jmx.mbeanserver.JmxMBeanServer@1a1ea46>
    [org.springframework.jmx.export.MBeanExporter] - <Located MBean 'Hibernate:name=statistics': registering with JMX server as MBean [Hibernate:name=statistics]>
    Any help?

    Regards,

  • #2
    Got it working already. It needed the server property
    Code:
    <jee:jndi-lookup id="server" jndi-name="java:comp/env/jmx/runtime" />

    Comment


    • #3
      It seems I was too quick. The MBean is exported and appears in the console but no data is collected. It's clearly a problem with the session factory now but I can't get it to work. How can I obtain a session factory or JNDI reference to it? I just have an EntityManagerFactory available.

      Regards,

      Comment


      • #4
        I've finally got it working. You can look at the final solution at http://internna.blogspot.com/2007/08...erprise-5.html.

        Comment

        Working...
        X