// Set the thread context classloader so deserializing classes can grab the cl from the thread
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(classLoader);
ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), classLoader);
try {
while (true) {
GBeanData gbeanData = new GBeanData();
gbeanData.readExternal(ois);
gbeans.add(gbeanData);
}
} catch (EOFException e) {
// ok
} finally {
ois.close();
}
} catch (ClassNotFoundException e) {
throw new InvalidConfigException("Class not loadable in classloader: " + classLoader, e);
} catch (NoClassDefFoundError e) {
throw new InvalidConfigException("Class not loadable in classloader: " + classLoader, e);