Crete a new User transaction instance.
if (obj instanceof TransactionRef) {
Reference ref = (Reference) obj;
ObjectFactory factory = null;
RefAddr factoryRefAddr = ref.get(Constants.FACTORY);
if (factoryRefAddr != null) {
// Using the specified factory
String factoryClassName =
factoryRefAddr.getContent().toString();
// Loading factory
ClassLoader tcl =
Thread.currentThread().getContextClassLoader();
Class factoryClass = null;
if (tcl != null) {
try {
factoryClass = tcl.loadClass(factoryClassName);
} catch(ClassNotFoundException e) {
}
} else {
try {
factoryClass = Class.forName(factoryClassName);
} catch(ClassNotFoundException e) {
}
}
if (factoryClass != null) {
try {
factory = (ObjectFactory) factoryClass.newInstance();
} catch(Throwable t) {
}
}
}
if (factory != null) {
return factory.getObjectInstance
(obj, name, nameCtx, environment);
} else {
throw new NamingException
("Cannot create resource instance");
}
}
return null;