read java.security.key stored as object inside a file which is in jar

Posted by Tal on Stack Overflow See other posts from Stack Overflow or by Tal
Published on 2010-05-09T16:01:47Z Indexed on 2010/05/09 16:08 UTC
Read the original article Hit count: 253

Filed under:
|

I saved a PublicKey instance in a file using ObjectOutputStream. This file is then stored inside a jar file which is then loaded by JBoss. I'm trying to read this file but it throws me an exception telling that it's not serializable. Here is the code :

InputStream input = KeyLoader.class.getClassLoader().getResourceAsStream(resource); ObjectInputStream objectInputStream = new ObjectInputStream(input); Object obj = objectInputStream.readObject(); Key output = (Key) obj; objectInputStream.close(); return output;

which throws me this exception An exception occurred: java.io.NotSerializableException

© Stack Overflow or respective owner

Related posts about publickey

Related posts about jar