THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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/1.0/car,J2EEServer=geronimo,j2eeType=TransactionManager, TransactionManagerLookup { name=TransactionManager"; public static final String UserTransactionName = "java:comp/UserTransaction"; public TransactionManager getTransactionManager(Properties props) throws HibernateException { try { Class Kernel kernelClasskernel = ClassKernelRegistry.forName("org.apache.geronimo.kernel.Kernel"getSingleKernel(); Class AbstractNameQuery kernelRegistryClassquery = new Class.forName("org.apache.geronimo.kernel.KernelRegistry"AbstractNameQuery(TransactionManager.class.getName ()); Class Set<AbstractName> proxyManagerClassnames = Classkernel.forName("org.apache.geronimo.kernel.proxy.ProxyManager"listGBeans(query); ObjectName TransactionManagerName = new ObjectName(TransactionMgrGBeanName); if (names.size() != 1) { Object kernelthrow =new kernelRegistryClass.getMethodIllegalStateException("getSingleKernel", null).invoke(null, null); Expected one transaction manager, not " + names.size()); } ObjectAbstractName proxyManagername = kernelClassnames.getMethoditerator("getProxyManager",null).invokenext(kernel,null); Class[] clzArray TransactionManager transMg = {ObjectName.class,Class.class};(TransactionManager) Object[] objArray = {TransactionManagerName, TransactionManager.class}; kernel.getGBean(name); return (TransactionManager)proxyManagerClass.getMethod("createProxy",clzArray).transMg; } catch (Exception e) { invoke(proxyManager, objArraye.printStackTrace(); }catch (Exception e) {System.out.println(); throw new HibernateException("Geronimo Transaction Manager Lookup Failed", e); } } public String getUserTransactionName() { return UserTransactionName; } } |
For your convenience this class is already provided in the <brokerage_home>/TransactionManager
directory. Create the following directory structure and copy the GeronimoTransactionManagerLookup.java
there.
...