Hi,
I have an application object which is serialized and stored in the session and it is deserialized to retrieve the value.
This was originally implemented in AEM 6.1
Now i am trying to migrate the application to AEM 6.3 , here the same code during deserialization is throwing "java.lang.UnsupportedOperationException: Deserialization not allowed for class "
Below is the code for deserialization
public static Object deserializeByteArray(final byte[] in) {
ByteArrayInputStream bis = null;
ObjectInputStream ois = null;
try {
bis = new ByteArrayInputStream(in);
ois = new ObjectInputStream(bis);
Object objectValue = (Object) ois.readObject();
return objectValue;
} catch (final ClassNotFoundException e) {
LOG.error("Caught CNFE decoding " + in.length + " bytes of data ", e);
} catch (final IOException e) {
LOG.error("Caught IOException decoding " + in.length + " bytes of data ", e);
} finally {
closeSilently(bis);
closeSilently(ois);
}
return null;
}
Can you try running this without trying to store in a session. What line of code is throwing an error. This is just straight Java and should work in AEM.
Views
Replies
Total Likes
I am getting error in Object objectValue = (Object) ois.readObject();
while attempting to readObject
Hard to say without knowing the class you are serializing; this sounds like a java concern. Make sure the class is serializable [1] .. maybe its some internal class that no longer implements Serializable?
[1] https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html
Views
Replies
Total Likes
You may need to 'whitelist' your class. See this:
@priyadarshinic9395328 : +1 for this answer.. we have seen similar thing happening in 6.2..
Views
Replies
Total Likes
Thank you so much , I was able to solve the issue following what was suggested.