src/main/java/org/jboss/util/naming/NonSerializableFactory.java
public static synchronized void rebind(Context ctx, String key, Object target) throws NamingException
    {
        NonSerializableFactory.rebind(key, target);
        // Bind a reference to target using NonSerializableFactory as the ObjectFactory
        String className = target.getClass().getName();
        String factory = NonSerializableFactory.class.getName();
        StringRefAddr addr = new StringRefAddr("nns", key);
        Reference memoryRef = new Reference(className, addr, factory, null);
        ctx.rebind(key, memoryRef);
    }
public static synchronized void rebind(Context ctx, String key, Object target) throws NamingException
    {
        NonSerializableFactory.rebind(key, target);
        // Bind a reference to target using NonSerializableFactory as the ObjectFactory
        String className = target.getClass().getName();
        String factory = NonSerializableFactory.class.getName();
        StringRefAddr addr = new StringRefAddr("nns", key);
        Reference memoryRef = new Reference(className, addr, factory, null);
        ctx.rebind(key, memoryRef);
    }
A convenience method that simplifies the process of rebinding a
non-serializable object into a JNDI context.

@param ctx the JNDI context to rebind to.
@param key the key to use in both the NonSerializableFactory map and JNDI. It
must be a valid name for use in ctx.bind().
@param target the non-Serializable object to bind.
@throws NamingException thrown on failure to rebind key into ctx.