I have a Stateful EJB and I want to serialize the reference to it(there is only ever one reference to the EJB).Will the EJB get garbage collected(as it is no longer referenced) or passivated at some point and if it gets passivated can I guarantee that the EJB will be activated for me if there have be no references to it for some arbitrary amount of time??
You should seperate two distinct processes: removal and passivation. Passivation doesn't affect you, as a client, in any way. It is just the container's way of freeing up resources. Whether a bean has been passivated or not is transparent to the client.
After a certain timeout has elapsed, the container may actually remove the bean. This means that the bean is no longer available for calls from clients, and further requests will result in NoSuchObjectException. If you want to be able to use the serialized remote reference (or even better, a serialized Handle) some time after you serialize it, configure your container's session bean timeout to be long enogth.