cancel
Showing results for 
Search instead for 
Did you mean: 

NotSerializableException reading file from configuration adapter

Former Member
0 Kudos

Hi!

When I try to access a file with config.getFile() that is stored in VA configuration adapter I get a P4BaseRuntimeException with an underlying NotSerializableException.

This is what I'm doing:


Context ctx = new InitialContext();
ConfigurationRuntimeInterface configInterface =  
	(ConfigurationRuntimeInterface)ctx.lookup("configuration");
cfgContext 	= configInterface.getConfigurationContext();
cfgHandler 	= cfgContext.getConfigurationHandler();
config	= cfgHandler.openConfiguration(path, ConfigurationHandler.READ_ACCESS);
boolean exists	= config.existsFile(filename);
InputStream is = config.getFile(filename);  // this is where the exception occurs

I've omitted handling for InconsistentReadException in this post, to keep the code short.

The existence check with config.existsFile() returns true, so configuration path and filename seem to be ok. However, config.getFile() throws a NotSerializableException.

So, how can I read a file from configuration adapter? What is my mistake?

Thanks for your help,

Frank

Accepted Solutions (0)

Answers (2)

Answers (2)

ravindra_bollapalli2
Active Contributor
0 Kudos

hi frank,

in addition to the above content

u can refer the how to use the config.getFile()

http://kickjava.com/src/org/apache/commons/configuration/reloading/FileChangedReloadingStrategy.java...

let me know u need any further info

bvr

former_member191569
Active Participant
0 Kudos

Hello Frank,

check http://java.sun.com/j2se/1.4.2/docs/api/java/io/NotSerializableException.html

I think the problem is that you are using a Java class which must implements Serializable interface.

Hope it helps.