-
1. Re: Hibernate HAR Archives + Deployment Ordering
jaikiran Jan 4, 2011 6:14 AM (in response to chkal)I'm not too sure what kind of support is available for .har files in AS6 (or for that matter AS5). I guess you'll have to change that packaging to .jar (and the some other related changes)
-
2. Re: Hibernate HAR Archives + Deployment Ordering
chkal Jan 4, 2011 7:52 AM (in response to jaikiran)<?xml version="1.0" encoding="ISO-8859-1"?><hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0"><!-- SessionFactory configuration --><session-factory name="java:/hibernate/HibernateFactory" bean="jboss.har:service=Hibernate"><!-- Datasource to use --><property name="datasourceName">java:/MySqlDS</property><!-- MySQL dialect --><property name="dialect">org.hibernate.dialect.MySQLDialect</property><!-- Dependencies --><depends>jboss:service=Naming</depends><depends>jboss:service=TransactionManager</depends></session-factory></hibernate-configuration>Thank you very much for your quick answer.
But what do you exactly mean by "JAR packaging"? My packaging is currently like this:
The HAR file has a META-INF/service-hibernate.xml file with the following content:
<?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0"> <!-- SessionFactory configuration --> <session-factory name="java:/hibernate/HibernateFactory" bean="jboss.har:service=Hibernate"> <!-- Datasource to use --> <property name="datasourceName">java:/MySqlDS</property> <!-- MySQL dialect --> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!-- Dependencies --> <depends>jboss:service=Naming</depends> <depends>jboss:service=TransactionManager</depends> </session-factory> </hibernate-configuration>
The HAR file is located inside an EAR file with a META-INF/jboss-app.xml like this:
<?xml version="1.0" encoding="UTF-8"?> <jboss-app> <module> <har>model.har</har> </module> <!-- Much more --> </jboss-app>
This should be the correct packaging for JBoss >5.0! The deployment works without problems. The only issue I am seeing is the missing JMX bean for jboss.har:service=Hibernate.
Unfortunately I'm working with a legacy app that is build with plain Hibernate and updating to JPA is no option!
-
3. Re: Hibernate HAR Archives + Deployment Ordering
jaikiran Jan 4, 2011 2:36 PM (in response to chkal)Looking at the code, the MBean named
jboss.har:service=Hibernate
should have been created. Where have you placed that .har file? -
4. Re: Hibernate HAR Archives + Deployment Ordering
jaikiran Jan 4, 2011 2:40 PM (in response to jaikiran)Also, enable DEBUG level logging of org.jboss.hibernate.deployers package and post the logs.
-
5. Re: Hibernate HAR Archives + Deployment Ordering
chkal Jan 5, 2011 9:25 AM (in response to jaikiran)Thank you very much for your help. The HAR archive is placed inside an EAR archive (see my previous post).
In the meantime I figured out that the <depends> element is working as expected. If I added it, the modules are deployed in the correct order and if I add a <depends> elements for some not-existing name, I get the expected exception (unsatisfied dependency). But the JMX entry for Hibernate still doesn't show up in the JMX console. I'm a bit confused! I thought that the <depends> elements refers to a JMX object name, so it should appear in the JMX console, right?
However, here are the relevant parts of the deployment log statements. Unfortunately I'm not allowed to post the full log file due to privacy requirements.
.... EJBs getting deployed .... 14:41:20,237 DEBUG [org.jboss.hibernate.deployers.HibernateDeployer] Created Hibernate bean: AbstractBeanMetaData@7490b4d0{name=jboss.har:service=Hibernate bean=org.jboss.hibernate.jmx.Hibernate properties=[sessionFactoryName, configurationElements] constructor=AbstractConstructorMetaData@484eff79{parameters=[org.jboss.vfs.VirtualFile]} autowireCandidate=true depends=[jboss:service=Naming, jboss:service=TransactionManager]} .... EJBs getting bound to JNDI .... 14:41:22,892 INFO [org.hibernate.annotations.common.Version] Hibernate Commons Annotations 3.2.0.Final 14:41:22,899 INFO [org.hibernate.cfg.Environment] Hibernate 3.6.0.Final 14:41:22,901 INFO [org.hibernate.cfg.Environment] hibernate.properties not found 14:41:22,904 INFO [org.hibernate.cfg.Environment] Bytecode provider name : javassist 14:41:22,910 INFO [org.hibernate.cfg.Environment] using JDK 1.4 java.sql.Timestamp handling 14:41:23,019 WARN [org.hibernate.util.DTDEntityResolver] recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide! .... More logging from Hibernate Core .... 14:41:23,221 INFO [org.hibernate.validator.Version] Hibernate Validator 3.1.0.GA 14:41:23,347 INFO [org.hibernate.validator.util.Version] Hibernate Validator 4.1.0.Final 14:41:23,358 INFO [org.hibernate.validator.engine.resolver.DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. 14:41:23,472 INFO [org.hibernate.validator.engine.resolver.DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. 14:41:23,477 INFO [org.hibernate.cfg.search.HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 14:41:23,489 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{} 14:41:23,489 INFO [org.hibernate.connection.DatasourceConnectionProvider] Using datasource: java:/MySqlDS 14:41:23,630 INFO [org.hibernate.cfg.SettingsFactory] Database -> name : MySQL version : 5.1.41-3ubuntu12.8 major : 5 minor : 1 14:41:23,630 INFO [org.hibernate.cfg.SettingsFactory] Driver -> name : MySQL-AB JDBC Driver version : mysql-connector-java-3.1.12 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ ) major : 3 minor : 1 14:41:23,660 INFO [org.hibernate.dialect.Dialect] Using dialect: org.hibernate.dialect.MySQLDialect 14:41:23,677 INFO [org.hibernate.engine.jdbc.JdbcSupportLoader] Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4 14:41:23,678 INFO [org.hibernate.transaction.TransactionFactoryFactory] Transaction strategy: org.hibernate.transaction.JTATransactionFactory 14:41:23,680 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{} 14:41:23,681 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup 14:41:23,681 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiated TransactionManagerLookup 14:41:23,682 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup 14:41:23,682 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiated TransactionManagerLookup 14:41:23,682 INFO [org.hibernate.cfg.SettingsFactory] Automatic flush during beforeCompletion(): enabled 14:41:23,682 INFO [org.hibernate.cfg.SettingsFactory] Automatic session close at end of transaction: enabled 14:41:23,682 INFO [org.hibernate.cfg.SettingsFactory] JDBC batch size: 15 14:41:23,682 INFO [org.hibernate.cfg.SettingsFactory] JDBC batch updates for versioned data: disabled 14:41:23,683 INFO [org.hibernate.cfg.SettingsFactory] Scrollable result sets: enabled 14:41:23,683 INFO [org.hibernate.cfg.SettingsFactory] JDBC3 getGeneratedKeys(): enabled 14:41:23,683 INFO [org.hibernate.cfg.SettingsFactory] Connection release mode: after_statement 14:41:23,684 INFO [org.hibernate.cfg.SettingsFactory] Maximum outer join fetch depth: 2 14:41:23,684 INFO [org.hibernate.cfg.SettingsFactory] Default batch fetch size: 1 14:41:23,684 INFO [org.hibernate.cfg.SettingsFactory] Generate SQL with comments: disabled 14:41:23,685 INFO [org.hibernate.cfg.SettingsFactory] Order SQL updates by primary key: disabled 14:41:23,685 INFO [org.hibernate.cfg.SettingsFactory] Order SQL inserts for batching: disabled 14:41:23,685 INFO [org.hibernate.cfg.SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 14:41:23,688 INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory 14:41:23,688 INFO [org.hibernate.cfg.SettingsFactory] Query language substitutions: {} 14:41:23,688 INFO [org.hibernate.cfg.SettingsFactory] JPA-QL strict compliance: disabled 14:41:23,689 INFO [org.hibernate.cfg.SettingsFactory] Second-level cache: enabled 14:41:23,689 INFO [org.hibernate.cfg.SettingsFactory] Query cache: disabled 14:41:23,690 INFO [org.hibernate.cfg.SettingsFactory] Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge 14:41:23,697 INFO [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.HashtableCacheProvider 14:41:23,699 INFO [org.hibernate.cfg.SettingsFactory] Optimize cache for minimal puts: disabled 14:41:23,699 INFO [org.hibernate.cfg.SettingsFactory] Structured second-level cache entries: disabled 14:41:23,707 INFO [org.hibernate.cfg.SettingsFactory] Statistics: disabled 14:41:23,707 INFO [org.hibernate.cfg.SettingsFactory] Deleted entity synthetic identifier rollback: disabled 14:41:23,707 INFO [org.hibernate.cfg.SettingsFactory] Default entity-mode: pojo 14:41:23,707 INFO [org.hibernate.cfg.SettingsFactory] Named query checking : enabled 14:41:23,707 INFO [org.hibernate.cfg.SettingsFactory] Check Nullability in Core (should be disabled when Bean Validation is on): disabled 14:41:23,764 INFO [org.hibernate.impl.SessionFactoryImpl] building session factory 14:41:24,382 INFO [org.hornetq.ra.inflow.HornetQActivation] Attempting to reconnect org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@6c370d57 destination=queue/documentQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15) 14:41:24,496 INFO [org.hornetq.ra.inflow.HornetQActivation] Reconnected with HornetQ 14:41:24,678 INFO [org.hibernate.impl.SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured 14:41:24,678 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{} 14:41:24,681 INFO [org.jboss.hibernate.jmx.Hibernate] SessionFactory successfully built and bound into JNDI [java:/hibernate/HibernateFactory] .... WARs getting deployed ....
After the deployment there seems to be no JMX entry for Hibernate:
$ ./twiddle.sh info jboss.har:service=Hibernate 14:46:06,622 ERROR [Twiddle] Exec failed javax.management.InstanceNotFoundException: jboss.har:service=Hibernate is not registered. at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:529) at org.jboss.mx.server.MBeanServerImpl.getMBeanInfo(MBeanServerImpl.java:677) at org.jboss.system.server.jmx.MBeanServerWrapper.getMBeanInfo(MBeanServerWrapper.java:67) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1421)
Any idea?
-
6. Re: Hibernate HAR Archives + Deployment Ordering
jaikiran Jan 5, 2011 9:34 AM (in response to chkal)Christian Kaltepoth wrote:
Starting AS5, the <depends> can be used for a MC bean too. That's the reason why the "depends" works. The "bean" attribute in the session-factory configuration is used as the MC bean name. It's just a co-incidence that it's in the form of the JMX ObjectName syntax.
Christian Kaltepoth wrote:
However, here are the relevant parts of the deployment log statements. Unfortunately I'm not allowed to post the full log file due to privacy requirements.
.... EJBs getting deployed .... 14:41:20,237 DEBUG [org.jboss.hibernate.deployers.HibernateDeployer] Created Hibernate bean: AbstractBeanMetaData@7490b4d0{name=jboss.har:service=Hibernate bean=org.jboss.hibernate.jmx.Hibernate properties=[sessionFactoryName, configurationElements] constructor=AbstractConstructorMetaData@484eff79{parameters=[org.jboss.vfs.VirtualFile]} autowireCandidate=true depends=[jboss:service=Naming, jboss:service=TransactionManager]}
That line shows that a MC bean with name
jboss.har:service=Hibernate
is being deployed as expected.After the deployment there seems to be no JMX entry for Hibernate:
Do you want it to be registered as a MBean too? Or is it just out of curiosity that you are looking for the MBean?
-
7. Re: Hibernate HAR Archives + Deployment Ordering
jaikiran Jan 5, 2011 9:35 AM (in response to jaikiran)jaikiran pai wrote:
Christian Kaltepoth wrote:
Starting AS5, the <depends> can be used for a MC bean too.
-
8. Re: Hibernate HAR Archives + Deployment Ordering
chkal Jan 5, 2011 9:50 AM (in response to jaikiran)jaikiran pai schrieb:
Do you want it to be registered as a MBean too? Or is it just out of curiosity that you are looking for the MBean?
No, that's not necessary. I just did the mistake of looking for jboss.har:service=Hibernate in the JMX Console because I assumed that there will be a JMX bean. :-)
Thank you very much for your help!
Christian