-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: StatisticsService MBean looks up SessionFactory too soon
PostPosted: Wed Feb 03, 2010 8:13 am 
Beginner
Beginner

Joined: Sat Sep 09, 2006 5:55 am
Posts: 23
I'm having some trouble to get the Hibernate statistics MBean deployed correctly in my jboss instance.

The MBean does a lookup of the session factory the moment the setter for the SessionFactoryJNDIName is called, but at that time the persistence unit it depends on is not yet deployed. This means the hibernate statistics mbean is not initialized properly.

This is from the *-service.xml (which I have put in the ear file):
Code:
  <mbean code="org.hibernate.jmx.StatisticsService"
         name="Hibernate:application=myApplication,type=statistics">
    <attribute name="StatisticsEnabled">True</attribute>
    <attribute name="SessionFactoryJNDIName">mySessionFactory</attribute>
    <depends>persistence.units:ear=myproject.ear,jar=myproject-ejb.jar,unitName=myPersistenceUnit</depends>
  </mbean>


The jboss debug logging at startup shows:
Code:
{org.jboss.system.ServiceConfigurator} - SessionFactoryJNDIName set to mySessionFactory in Hibernate:application=myApplication,type=statistics
{org.hibernate.jmx.StatisticsService} - No session factory with JNDI name mySessionFactory
javax.naming.NameNotFoundException: mySessionFactory not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)

but this is logged before the persistence unit is deployed. After the persistence unit is deployed, the logs show that the hibernate statistics service is started. I would have expected the jndi lookup of the SessionFactory to be done at this time rather than when setting the jndi name on the statistics mbean.

Can anyone help me with how to get this deployed properly?

I guess I could wrap the hibernate mbean in my own mbean and only set the jndi name of the session factory when the mbean is started, but I figure there must be a better way.

Thanks in advance!

_________________
Cheers,

Guy Mahieu


Top
 Profile  
 
 Post subject: Re: StatisticsService MBean looks up SessionFactory too soon
PostPosted: Wed Mar 24, 2010 2:39 pm 
Newbie

Joined: Tue Mar 09, 2010 6:30 pm
Posts: 6
Hi,

I'm encountering a similar problem. I've tried to add it in my sar, ear and jar but I always have this issue since it comes before the session factory is initialized during deployment. have you found a solution to your problem?

Regards,

Greg


Top
 Profile  
 
 Post subject: Re: StatisticsService MBean looks up SessionFactory too soon
PostPosted: Wed Mar 24, 2010 4:56 pm 
Newbie

Joined: Tue Mar 09, 2010 6:30 pm
Posts: 6
Hi,

I just wanted to offer to post a bug report if people would be kind enough to let me know what they require to reproduce this issue, I can provide sample configuration files for jboss 5.1-GA.

Regards,

Greg


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.