We have (are trying to) use Hibernate 2.1 final in conjunction with the JBoss 3.2.2 container. The container is configured to operate as part of a high-availability cluster, uses MySQL as the under-lying defaultDS and persistence container. MySQL is installed as a service and is the defaultDS provider.
We have installed Hibernate 2.1 final as a service with the following MBEAN:
<?xml version="1.0" encoding="UTF-8"?>
<!--
|==============================================================================
| Hibernate Service Configuration
|==============================================================================
-->
<server>
<mbean
code="net.sf.hibernate.jmx.HibernateService"
name="jboss.jca:service=HibernateFactory,name=HibernateFactory">
<depends>
jboss.jca:service=RARDeployer
</depends>
<!-- Make it deploy ONLY after DataSource had been started -->
<depends>
jboss.jca:service=LocalTxCM,name=DefaultDS
</depends>
<!-- Hold off on map sources... not ready yet.
<attribute name="MapResources">
hibernate_mappings/radar_msg_250.hbm.xml,
hibernate_mappings/radar_msg_210.hbm.xml
</attribute>
-->
<attribute name="JndiName">
java:/hibernate/HibernateFactory
</attribute>
<attribute name="Datasource">
java:/DefaultDS
</attribute>
<attribute name="Dialect">
net.sf.hibernate.dialect.MySQLDialect
</attribute>
<attribute name="TransactionStrategy">
net.sf.hibernate.transaction.JTATransactionFactory
</attribute>
<attribute name="TransactionManagerLookupStrategy">
net.sf.hibernate.transaction.JBossTransactionManagerLookup
</attribute>
<attribute name="UseOuterJoin">
false
</attribute>
<attribute name="ShowSql">
false
</attribute>
<attribute name="UserTransactionName">
java:/UserTransaction
</attribute>
</mbean>
</server>
This configuration seems to work to a point but there is an unresolved item in the LOG4J output. I am trying to resolve the issue but don't understand the messages I see. The snippet from the log is as follows:
<snip>...
12:04:09,171 INFO [FarmMemberService] Creating
12:04:09,171 INFO [FarmMemberService] Created
12:04:09,171 INFO [AbstractDeploymentScanner$ScannerThread] Running
12:04:09,171 INFO [CachedConnectionManager] Starting
12:04:09,203 INFO [CachedConnectionManager] Started
12:04:09,203 INFO [TxConnectionManager] Starting
12:04:09,234 INFO [JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@205df9
12:04:09,234 INFO [JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@1a2264c
12:04:09,234 INFO [JaasSecurityManagerService] Added JmsXARealm, org.jboss.security.plugins.SecurityDomainContext@804a77 to map
12:04:09,250 INFO [JmsXA] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=TxCM,name=JmsXA to JNDI name 'java:/JmsXA'
12:04:09,250 INFO [TxConnectionManager] Started
12:04:09,250 INFO [TxConnectionManager] Starting
12:04:09,265 INFO [DefaultDS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'java:/DefaultDS'
12:04:09,265 INFO [TxConnectionManager] Started
12:04:09,265 INFO [HibernateServiceMBean] starting service at JNDI name: java:/hibernate/HibernateFactory
12:04:09,265 INFO [HibernateServiceMBean] service properties: {hibernate.session_factory_name=java:/hibernate/HibernateFactory, hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.show_sql=false, hibernate.use_outer_join=false, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory, hibernate.connection.datasource=java:/DefaultDS, jta.UserTransaction=java:/UserTransaction}
12:04:09,296 INFO [Environment] Hibernate 2.1 final
12:04:09,312 INFO [Environment] hibernate.properties not found
12:04:09,312 INFO [Environment] using CGLIB reflection optimizer
12:04:09,312 INFO [Configuration] processing one-to-many association mappings
12:04:09,328 INFO [Configuration] processing one-to-one association property references
12:04:09,328 INFO [Configuration] processing foreign key constraints
12:04:09,375 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.MySQLDialect
12:04:09,375 INFO [SettingsFactory] Use outer join fetching: false
12:04:09,375 INFO [NamingHelper] JNDI InitialContext properties:{}
12:04:09,390 INFO [DatasourceConnectionProvider] Using datasource: java:/DefaultDS
12:04:09,390 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
12:04:09,390 INFO [NamingHelper] JNDI InitialContext properties:{}
12:04:09,406 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
12:04:09,406 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
12:04:09,406 INFO [NamingHelper] JNDI InitialContext properties:{}
12:04:09,406 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
12:04:09,406 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
12:04:09,796 INFO [SettingsFactory] Use scrollable result sets: true
12:04:09,796 INFO [SettingsFactory] JDBC 2 max batch size: 15
12:04:09,796 INFO [SettingsFactory] Query language substitutions: {}
12:04:09,796 INFO [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
12:04:09,796 INFO [HibernateServiceMBean] Could not build SessionFactory using the MBean classpath - will try again using client classpath: could not instantiate CacheProvider: net.sf.ehcache.hibernate.Provider
12:04:09,859 INFO [SessionFactoryObjectFactory] Factory name: java:/hibernate/HibernateFactory
12:04:09,859 INFO [NamingHelper] JNDI InitialContext properties:{}
12:04:09,859 INFO [NamingHelper] Creating subcontext: hibernate
12:04:09,859 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:/hibernate/HibernateFactory
12:04:09,859 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
12:04:09,859 INFO [PersistenceManager] Starting
12:04:09,937 INFO [PersistenceManager] Started
12:04:09,937 INFO [DestinationManager] Starting
12:04:09,953 INFO [DestinationManager] Started
12:04:09,953 INFO [A] Starting
12:04:09,984 INFO [A] Bound to JNDI name: queue/A
12:04:09,984 INFO [A] Started
12:04:09,984 INFO [B] Starting
12:04:09,984 INFO [B] Bound to JNDI name: queue/B
12:04:09,984 INFO [B] Started
12:04:09,984 INFO [C] Starting
12:04:09,984 INFO [C] Bound to JNDI name: queue/C
12:04:09,984 INFO [C] Started
12:04:09,984 INFO [D] Starting
12:04:10,000 INFO [D] Bound to JNDI name: queue/D
12:04:10,000 INFO [D] Started
12:04:10,000 INFO [ex] Starting
12:04:10,000 INFO [ex] Bound to JNDI name: queue/ex
12:04:10,000 INFO [ex] Started
12:04:10,000 INFO [SecurityManager] Starting
12:04:10,015 INFO [JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@a42c89
12:04:10,031 INFO [JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@67e92a
12:04:10,031 INFO [JaasSecurityManagerService] Added jbossmq, org.jboss.security.plugins.SecurityDomainContext@1fccfe3 to map
12:04:10,031 INFO [SecurityManager] Started
...<snip>
My questions/issues are as follows:
A) At first, ehcache was unresolved, so I added the ehcache jar to the application classpath (.../lib/ehcache.jar). This seemed to resolve the issue of not finding the ehcache object, but led to the next issue(s). Since JBoss has built-in Cache, Coherency, and Transaction managers, why do I need ehcache? Why aren't the default JBoss services bound here instead?
B) From the log above:
....
12:04:09,296 INFO [Environment] Hibernate 2.1 final
...
12:04:09,375 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.MySQLDialect
...
12:04:09,796 INFO [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
12:04:09,796 INFO [HibernateServiceMBean] Could not build SessionFactory using the MBean classpath - will try again using client classpath: could not instantiate CacheProvider: net.sf.ehcache.hibernate.Provider
12:04:09,859 INFO [SessionFactoryObjectFactory] Factory name: java:/hibernate/HibernateFactory
12:04:09,859 INFO [NamingHelper] JNDI InitialContext properties:{}
12:04:09,859 INFO [NamingHelper] Creating subcontext: hibernate
12:04:09,859 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:/hibernate/HibernateFactory
12:04:09,859 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
...
Why does The HibernateServiceMBean say it could not build the session factory object? It says it couldn't instantiate the CacheProvider, didn't this happen in the prior step, when the SettingsFactory supposedly linked the cacheFactory service?
There seems to be some unresolved issue around the session "[HibernateServiceMBean] Could not build SessionFactory using the MBean classpath ". Why doesn't Hibernate link up with the default Session services within JBoss? What about the JBoss JTA service that the service MBEAN tried to link in. What became of that? Shouldn't the SessionFactoryObject be bound to an equivalent JTA service?
I am a bit puzzled since these appeared to be working (in some form) under Jboss using either of the last 2 Hibernate candidate builds. Just dropping in 2.1 final with assoicated jars broke things.
Any information you can share would be appreciated.
Thank you.
_________________ Normand Martel
Software Engineer
MIT Lincoln Labratory
Lexington, MA USA
|