Atomikos Forum |
|
Guys,
I am in the process of integrating Hibernate and Atomikos. My resource is managed by the Tomcat container in the context.xml. <Resource auth="Container" factory="com.atomikos.tomcat.BeanFactory" maxPoolSize="120" minPoolSize="5" name="jdbc/MNA_XA_Managed" testQuery="select 1 from dual" type="com.atomikos.jdbc.AtomikosDataSourceBean" uniqueResourceName="AtomikosDataSourceJDBCOracle.MNA" xaDataSourceClassName="oracle.jdbc.xa.client.OracleXADataSource" xaProperties.URL="..." xaProperties.password="..." xaProperties.user="..." /> The following properties are defined in my Hibernate SessionFactory: <property name="hibernateProperties"> <props> <prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory </prop> <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup </prop> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> ... </property> When I launch my web app, it seems like a lot of libraries need to be present in my tomcat/lib directory in order for the application to work. Below is a list of libraries that I needed to move from my application's WEB-INF/lib directory to the tomcat/lib directory. Is this all really necessary? Or did I do something wrong? commons-collections-3.2.1.jar commons-logging-1.1.1.jar dom4j-1.6.1.jar ejb3-persistence-1.0.2.GA.jar hibernate-annotations-3.4.0.GA.jar hibernate-commons-annotations-3.1.0.GA.jar hibernate-core-3.3.2.GA.jar javassist-3.14.0-GA.jar jta.jar ojdbc6-11.1.0.7.0.jar orai18n.jar slf4j-api-1.6.0.jar transactions.jar transactions-api.jar transactions-hibernate3.jar transactions-jdbc.jar transactions-jms.jar transactions-jta.jar transactions-osgi.jar
Hi Guy,
I was aware of the jta and transaction* dependencies. The reason I now all of a sudden have a lot of Hibernate dependencies in the Tomcat container to Hibernate thingies is because I tried to implement the workaround suggested in this JIRA: https://jira.springsource.org/browse/SPR-1976 The HibernateConnectionDataSource class suggested by this Jira issue as a workaround introduces those Hibernate dependencies. So it is not really an option when you want to keep a lightweight Tomcat. :-(
Guy,
Upon further investigation, it turns out that the entire array of Hibernate dependencies are introduced by the following entries in the hibernateProperties of the sessionFactory: <prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory</prop> <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop> These two properties are mentioned in the "Hibernate Integration" page http://www.atomikos.com/Documentation/HibernateIntegration It seems odd to me that I would have to include the entire Hibernate stack in my J2EE container when I define my datasource as a resource in Tomcat. Your thoughts? Regards, Rik
One more thing...
Looking at the source code of com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory, I see the following comment: "Atomikos-specific JTATransactionFactory implementation that does not rely on JNDI for standalone (JNDI-less) deployments." What I try to do is use the Atomikos transaction manager at Tomcat level. My WARs use Spring+Hibernate, so that is where I would like Hibernate to use the Atomikos transaction manager.
No problem:-) Can I ask one favor in return: if you could document this in our Tomcat/Hibernate integration pages on the wiki at http://www.atomikos.com/Documentation ?
I would do it, but I think it is best if you have a go first because you experienced the problem and hence know where/how to formulate things... Thanks
Hello
FYI the Hibernate/JPA/Atomikos integration is also well documented on this article: http://alexandros-karypidis.blogspot.com/2011/06/integrating-jetty-spring-aspectj-wicket.html |