commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "raghutpk (Created) (JIRA)" <>
Subject [jira] [Created] (CONFIGURATION-478) Cannot write to files within an app server directory
Date Wed, 08 Feb 2012 05:12:59 GMT
Cannot write to files within an app server directory

                 Key: CONFIGURATION-478
             Project: Commons Configuration
          Issue Type: Bug
          Components: Build
    Affects Versions: 1.8, 1.7
         Environment: Java , Linux, Jboss
            Reporter: raghutpk


This issue is really grappling me. I use  Apache commons configuration to read the configuration
for my application. I expose my configuration through a jmx client so that I can change the
configuration at runtime and would like to persist the changes to the original load form.

I have multiple configuration sources so I use a CombinedConfiguration object to read in my
config.xml file. I have wrapped custom logic and rules to save the confgiuration to the persistent
I use Jboss AS5 to deploy my application. 

All is well when I have configuration files in the filesystem outside  $JBOSS-HOME/server/default/deploy.
I am able to read fine and write back to the config files fine too. 
but the problem is when I bring in the Config files in the following directoy $JBOSS-HOME/server/default/deploy/{application-name}/..
I can read the configuration fine, but when I try to write the configuration back to the persistent
store using the save method of the respective configuration(like PropertiesConfiguration &
XMLConfiguration) using a jmx client(I also tried to harcode and save within code immediatly
after reading my configuration). I keep getting the follwing exception : protocol doesn't support output
	at org.apache.commons.configuration.DefaultFileSystem.getOutputStream(
	at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(
	at org.apache.commons.configuration.AbstractFileConfiguration.clearProperty(
	at org.apache.commons.configuration.AbstractConfiguration.setProperty(
	at org.apache.commons.configuration.AbstractFileConfiguration.setProperty(

Please throw some light on the exception because it is helping me nowhere in understanding
the issue
If I am able to read it, I should also be able to save it back..but it is not happening within
JBOSS directory(I can only read). Moment I shift my configurations outside that to a different
place in the Filesystem say /home/../Config and also keep the config.xml(containing the reference
to the Configuration sources)it is perfectly working fine.

This is being a blocker for me. I may have completely misread the scenario, so please throw
light on the same if I am missing anything or more details are needed.

Following is the piece of code used to read the configuration :

builder.setFile(new File(Path to CONFIG_DIRECTORY +
CombinedConfiguration combinedConfig = builder.getConfiguration(true); 

sample config.xml file : 

<?xml version="1.0" encoding="ISO-8859-1"?>
	<header />
			autoSave="true" config-name="properties1" />
			autoSave="true" config-name="properties2" />
			autoSave="true" config-name="properties3" />
		<xml fileName="gui.xml"
			autoSave="true" config-name="xml1" />
	<additional />

Following is sample code used to write back updated values to the persistent store :

	xmlConfig = (XMLConfiguration) combinedConfig.getConfiguration("configuration source name");;
							if (xmlConfig.containsKey(key)) {
								try {

									// Update the value.
									xmlConfig.setProperty(key, value);;

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message