commons-issues mailing list archives

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


raghutpk closed CONFIGURATION-479.

    Resolution: Duplicate
> Cannot write to files within an app server directory
> ----------------------------------------------------
>                 Key: CONFIGURATION-479
>                 URL:
>             Project: Commons Configuration
>          Issue Type: Bug
>          Components: Build
>    Affects Versions: 1.7, 1.8
>         Environment: Java , Linux, Jboss
>            Reporter: raghutpk
>              Labels: commons, configuration
>   Original Estimate: 24h
>  Remaining Estimate: 24h
> Hi 
> 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 store.
> 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
> 	at org.apache.commons.configuration.DefaultFileSystem.getOutputStream(
> 	at
> 	at
> 	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"?>
> <configuration>
> 	<header />
> 	<override>
> 		<properties
> 			fileName=""
> 			autoSave="true" config-name="properties1" />
> 	<properties
> 			fileName=""
> 			autoSave="true" config-name="properties2" />
> 		<properties
> 			fileName="test.xml"
> 			autoSave="true" config-name="properties3" />
> 		<xml fileName="gui.xml"
> 			autoSave="true" config-name="xml1" />
> 	</override>
> 	<additional />
> </configuration>
> Following is sample code used to write back updated values to the persistent store :
> 	xmlConfig = (XMLConfiguration) combinedConfig.getConfiguration("configuration source
> 							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