Code example for InvalidObjectException

0
		if (result==null) {
			// in case we were deserialized in a different JVM, look for an instance with the same name 
			// (alternatively we could do an actual JNDI lookup here....) 
			result = SessionFactoryObjectFactory.getNamedInstance(name);
			if (result==null) {
				throw new InvalidObjectException("Could not find a stub SessionFactory named: " + name);
			} 
			else { 
				log.debug("resolved stub SessionFactory by name");
			} 
		} 
		else { 
			log.debug("resolved stub SessionFactory by uid");
		} 
		return result;
	} 
	 
	/** 
	 * @see javax.naming.Referenceable#getReference() 
	 */ 
	public Reference getReference() throws NamingException {