|
thanks kevan, (about jpa ... too late, and too "lazy", me, not
hibernate :-) yes, i of course i modified the hibernate.transaction.manager_lookup_class, pointing to the class found on the wiki (which is not really perfect in the getMethod calls ...) so, i can work on it, trying to set up a correct lookup class for geronimo if you confirm me the the jndi name for the UserTransaction in geronimo is the usual "java:comp/UserTransaction" the hibernate configuration is this spring config ======================== <!-- datasource --> <jee:jndi-lookup id="dataSource" jndi-name="jdbc/myappDS" resource-ref="true" /> <!-- Hibernate configuration --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="location" value="classpath:com/myapp/data/hibernate.properties"/> </bean> </property> <property name="mappingDirectoryLocations"> <list> <value>classpath:com/myapp/data/dao/hibernate</value> </list> </property> <property name="eventListeners"> <map> <entry key="merge"> <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/> </entry> </map> </property> </bean> hibernate.properties ================================ hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect hibernate.current_session_context_class=jta hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory hibernate.transaction.manager_lookup_class=org.hibernate.transaction.GeronimoTransactionManagerLookup hibernate.cache.use_second_level_cache=false hibernate.cache.use_query_cache=false hibernate.show_sql=true hibernate.hbm2ddl.auto=update as you can see, the datasource is looked up in jndi (it has been imported from jboss and it looks ok) and configured in geronimo-web-xml together with javamail =================== <dep:dependencies> <dependency> <groupId>console.dbpool</groupId> <artifactId>myappDS</artifactId> <version>1.0</version> <type>rar</type> </dependency> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>javamail</artifactId> <version>2.0.1</version> <type>car</type> </dependency> </dep:dependencies> .... <resource-ref> <ref-name>jdbc/myappDS</ref-name> <resource-link>myappDS</resource-link> </resource-ref> <resource-ref> <ref-name>mail/DefaultMail</ref-name> <resource-link>mail/MailSession</resource-link> </resource-ref> and this is the updated version of the GeronimoTransactionManagerLookup class (with some modifications ...) =========================== package org.hibernate.transaction; import java.util.Properties; import javax.management.ObjectName; import javax.transaction.TransactionManager; import org.hibernate.HibernateException; import org.hibernate.transaction.TransactionManagerLookup; public class GeronimoTransactionManagerLookup implements TransactionManagerLookup { public static final String TransactionMgrGBeanName="geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/2.0.1/car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionManager"; public static final String UserTransactionName = "java:comp/UserTransaction"; public TransactionManager getTransactionManager(Properties props) throws HibernateException { try { Class kernelClass = Class.forName("org.apache.geronimo.kernel.Kernel"); Class kernelRegistryClass = Class.forName("org.apache.geronimo.kernel.KernelRegistry"); Class proxyManagerClass = Class.forName("org.apache.geronimo.kernel.proxy.ProxyManager"); ObjectName TransactionManagerName = new ObjectName(TransactionMgrGBeanName); Object kernel = kernelRegistryClass.getMethod("getSingleKernel", new Class[] {}).invoke(null, new Object[] {}); Object proxyManager = kernelClass.getMethod("getProxyManager",new Class[] {}).invoke(kernel,new Object[] {}); Class[] clzArray = {ObjectName.class,Class.class}; Object[] objArray = {TransactionManagerName, TransactionManager.class}; return (TransactionManager)proxyManagerClass.getMethod("createProxy",clzArray). invoke(proxyManager, objArray); }catch (Exception e) { throw new HibernateException("Geronimo Transaction Manager Lookup Failed", e); } } public String getUserTransactionName() { return UserTransactionName; } } Kevan Miller wrote:
|
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot Kevan Miller
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot David Jencks
- Re: Problem at geronimo boot Kevan Miller
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot Kevan Miller
- Re: Problem at geronimo boot Jason Warner
- Re: Problem at geronimo boot Kevan Miller
- Re: Problem at geronimo boot Jason Warner
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot Viet Nguyen
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot Kevan Miller
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot Kevan Miller
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot Paolo Denti
- Re: Problem at geronimo boot Kevan Miller
- Re: Problem at geronimo boot Viet Nguyen
