InitialContext ctx = EJB3Util.getInitialContext(properties);
try
{
if (serializable)
{
Util.rebind(ctx, bindTo, target);
}
else
{
NonSerializableFactory.rebind(ctx, bindTo, target);
}
} catch (NamingException e)
{
NamingException namingException = new NamingException("Could not bind JndiBinder service into JNDI under jndiName:" + ctx.getNameInNamespace() + "/" + bindTo);
namingException.setRootCause(e);
throw namingException;
}