commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arja srinivasu <>
Subject Null pointer exception while creating a XMLConfiguration object in a static method.
Date Tue, 11 May 2010 16:50:56 GMT
I have been running into an issue while creating an xml configuration object from an xml
file, I am using jdk 1.6.0_20 and commons-configuration-1.6.jar, similar code works when the
method is non-static, appreciate any comments or pointers in resolving this issue

Here is the code which is creating this XMLConfiguration object.
privatestatic void load(String dataFilePath)throwsExceptionnull;null;   finalFile dataFile
= newFile(dataFilePath);"Data file does not exist: "+ dataFile);// this check succeeds no
assertion error is thrown"Data file is not readable: "+ dataFile);// this check succeeds no
assertion error is thrown"Reading the data file: "+ dataFile);newXMLConfiguration(dataFileURL);
   URL dataFileURL = 
   HierarchicalConfiguration dataFromFile = 
   dataFileURL = ConfigurationUtils.locate(dataFilePath); //Returns a proper url of the
file passed.
   dataFromFile = 
Here is a partial stack trace of the error:

at Source) [na:1.6.0_20]
at Source) [na:1.6.0_20]
at org.apache.commons.configuration.ConfigurationUtils.fileFromURL(
at org.apache.commons.configuration.AbstractFileConfiguration.load(
at org.apache.commons.configuration.AbstractFileConfiguration.load(
at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.load(
at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.<init>(
at org.apache.commons.configuration.XMLConfiguration.<init>(
Thanks in advance.
--Srinu: [commons-configuration-1.6.jar:1.6]
[commons-configuration-1.6.jar:1.6] [commons-configuration-1.6.jar:1.6]
[commons-configuration-1.6.jar:1.6] [commons-configuration-1.6.jar:1.6]


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message