So which JNDI implementations can't you put UserTransaction in? It supports getObjectInstance and we've been deploying it/them into various JNDI implementations over the years.
If you want to put the UserTransaction into a com.sun.jndi.rmi.registry.RegistryContextFactory like me, then it won't work because you can't bind it to the RMI.
I guess that's the reason why they wanted UserTransaction to be Referenceable/Serializable in the JTA spec since RegistryContextFactory is one of the standard Java JNDI providers after all.
OK, so you're looking at a thin-client approach (access UT remotely so nothing runs on the client-side)?
Not really a thin-client, we are in a non-managed environment featuring Hibernate for persistency and have just picked the registry as our JNDI provider to store DataSources in (along with RMI Remote interfaces for remoting).
Now we'd also like to store the UserTransaction there so Hibernate can find it but it ain't possible.
Now we'd also like to store the UserTransaction there so Hibernate can find it but it ain't possible
Have you tried storing a reference instead? While our UserTransaction doesn't implement Serializable or Externalizable, a miskate we will rectify, it does implement ObjectFactory.
final UserTransaction userTransaction = ...
final String userTransactionImpl = userTransaction.getClass().getName() ;
final Reference ref = new Reference(userTransactionImpl, userTransactionImpl, null) ;
initialContext.bind(jndiName, ref) ;