@Before
 public void setUp() throws Exception {
   jndiServer = startJndiServer();
   ctx = createJndiContext();
   // Inject configuration to initialise transaction manager from config classloader
   lookup.init(new ConfigurationBuilder().build());
   bindTransactionManager();
   bindUserTransaction();
 }
 private void bindTransactionManager() throws Exception {
   // as JBossTransactionManagerLookup extends JNDITransactionManagerLookup we must also register
   // the TransactionManager
   bind(
       "java:/TransactionManager",
       lookup.getTransactionManager(),
       lookup.getTransactionManager().getClass(),
       ctx);
 }
 private void bindUserTransaction() throws Exception {
   // also the UserTransaction must be registered on jndi:
   // org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory#getUserTransaction()
   // requires this
   bind(
       "UserTransaction",
       lookup.getUserTransaction(),
       lookup.getUserTransaction().getClass(),
       ctx);
 }