Session factory for statistics mbean cannot be set with dependencies
--------------------------------------------------------------------
Key: HHH-5050
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5050
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: JBoss 5.1 GA (using JPA)
DBMS: MSSQL 2005
Reporter: Greg V
Priority: Minor
There seems to be an issue with configuring the statistics mbean when not using specific
session factories.
Here's the test case I've been using:
1) Configure an ejb-jar to use statistics. jboss-service.xml:
{code}
<mbean code="org.hibernate.jmx.StatisticsService"
name="Hibernate:application=HibernateTest,type=statistics">
<depends>jboss:service=Naming</depends>
<depends>jboss.j2ee:ear=HibernateTest.ear,jar=HibernateTest.jar,name=myManager,service=EJB3</depends>
<attribute
name="SessionFactoryJNDIName">hibernateTestSF</attribute>
</mbean>
{code}
2) Enable statistics in persistence.xml and configure the session factory:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<persistence
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="HibernateTest" transaction-type="JTA">
<jta-data-source>java:datasources/HibernateTest</jta-data-source>
<properties>
<property name="hibernate.dialect"
value="com.c3.hibernate.dialect.SQLServerUnicodeDialect" />
<property name="hibernate.hbm2ddl.auto"
value="none" />
<property name="hibernate.show_sql"
value="true" />
<property name="hibernate.generate_statistics"
value="true" />
<property
name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.cache.use_query_cache"
value="true" />
<property name="hibernate.cache.region.factory_class"
value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory" />
<property
name="hibernate.cache.region.jbc2.cachefactory"
value="java:CacheManager" />
<property
name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"
/>
<property
name="hibernate.cache.region.jbc2.cfg.query" value="local-query"
/>
<property name="hibernate.cache.region_prefix"
value="HibernateTest" />
<property name="hibernate.session_factory_name"
value="hibernateTestSF"/>
</properties>
</persistence-unit>
</persistence>
{code}
3) Startup jboss. Despite the dependency on the mbean, it tries to set its session factory
jndi name, which results in the following:
{org.hibernate.jmx.StatisticsService} - No session factory with JNDI name hibernateTestSF
Which is normal because the ejb-jar has not been fully deployed yet (although it has
started deploying, the session factory from persistence.xml seems to get bound later on
according to my server logs). If I don't set the session factory jndi name on the
mbean it deploys fine and if I set it after the server has started via the jmx console,
all is well. I think there might be an issue either with the dependency or with the setter
in the mbean.
If you need a sample maven project or if the test case is not clear enough or the assigned
component is not the right one, let me know.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira