commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: Using Reloadable properties
Date Sun, 29 Apr 2007 10:17:07 GMT
Sharma, Rohit wrote:
> Per Rel 1.4 Notes:
> 
> File-based configurations with a reloading strategy did not work well 
> 
>   together with CombinedConfiguration because the reloading strategy is
> only 
> 
>   checked when its associated configuration is accessed (which does not 
> 
>   happen when only the combined configuration is queried). As a
> workaround 
> 
>   CombinedConfiguration now provides the boolean forceReloadCheck
> property. 
> 
>   If this is set to true, all contained configurations will be triggered
> when 
> 
>   a property is queried. This will cause a reload if necessary. Issue: 
> 
>   CONFIGURATION-240.
> 
>  
> 
> But I do not see such a method in java docs.

It's there in the 1.4 release:
http://jakarta.apache.org/commons/configuration/apidocs/org/apache/commons/configuration/CombinedConfiguration.html#setForceReloadCheck(boolean)

> 
>  
> 
> Also, when I define my Config file as below, I get the following error :
> 
>  
> 
> <!-- Test configuration definition file that demonstrates complex
> initialization -->
> 
> <configuration>
> 
>   <header>
> 
>     <result delimiterParsingDisabled="true" forceReloadCheck="true">
> 
>       <expressionEngine
> config-class="org.apache.commons.configuration.tree.xpath.XPathExpressio
> nEngine"/>
> 
>     </result>
> 
>   </header>
> 
>   <override>
> 
>     <properties fileName="test_reloadable.properties"
> throwExceptionOnMissing="false"
> 
>       config-name="propertiesTest" config-optional="true">
> 
>       <reloadingStrategy refreshDelay="1000"
> 
>  
> config-class="org.apache.commons.configuration.reloading.FileChangedRelo
> adingStrategy"/>
> 
>     </properties>
> 
>     <properties fileName="test2.properties"
> throwExceptionOnMissing="false"
> 
>       config-name="properties2" config-optional="true">
> 
>       <reloadingStrategy refreshDelay="1000"
> 
>  
> config-class="org.apache.commons.configuration.reloading.FileChangedRelo
> adingStrategy"/>
> 
>     </properties>
> 
>   </override>
> 
> </configuration>
> 
>  
> 
> Error:
> 
> java.lang.NoClassDefFoundError:
> org/apache/commons/jxpath/ri/model/NodePointerFactory
> 
This error is caused by the definiiton of the XPathExpressionEngine. You
need to have Commons JXPath in your class path to use this engine. Have
a look at the dependencies page:
http://jakarta.apache.org/commons/configuration/dependencies.html

Oliver

>       at java.lang.Class.forName0(Native Method)
> 
>       at java.lang.Class.forName(Class.java:219)
> 
>       at
> org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:545)
> 
>       at
> org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:593)
> 
>       at
> org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:576)
> 
>       at
> org.apache.commons.configuration.beanutils.BeanHelper.loadClass(BeanHelp
> er.java:297)
> 
>       at
> org.apache.commons.configuration.beanutils.BeanHelper.fetchBeanClass(Bea
> nHelper.java:322)
> 
>       at
> org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHel
> per.java:244)
> 
>       at
> org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHel
> per.java:266)
> 
>       at
> org.apache.commons.configuration.beanutils.BeanHelper.initBean(BeanHelpe
> r.java:176)
> 
>       at
> org.apache.commons.configuration.beanutils.DefaultBeanFactory.initBeanIn
> stance(DefaultBeanFactory.java:106)
> 
>       at
> org.apache.commons.configuration.beanutils.DefaultBeanFactory.createBean
> (DefaultBeanFactory.java:62)
> 
>       at
> org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHel
> per.java:244)
> 
>       at
> org.apache.commons.configuration.beanutils.BeanHelper.createBean(BeanHel
> per.java:266)
> 
>       at
> org.apache.commons.configuration.DefaultConfigurationBuilder.createResul
> tConfiguration(DefaultConfigurationBuilder.java:517)
> 
>       at
> org.apache.commons.configuration.DefaultConfigurationBuilder.getConfigur
> ation(DefaultConfigurationBuilder.java:482)
> 
>       at .................
> 
>  
> 
> ____________________________________________
> 
> Rohit Sharma / Capgemini / Dallas
> 
> Consultant
> 
> Mobile: +1 213-291-4417 / www.capgemini.com
> 
>  
> 
> Join the Collaborative Business Experience
> 
> ____________________________________________
> 
>  
> 
>  
> 
>  
> 
> -----Original Message-----
> From: Oliver Heger [mailto:oliver.heger@oliver-heger.de] 
> Sent: Saturday, April 28, 2007 10:45 AM
> To: Jakarta Commons Users List
> Subject: Re: Using Reloadable properties
> 
>  
> 
> Sharma, Rohit wrote:
> 
> 
>>I am trying to use the Configuration Factory to load my properties.
> 
> 
> 
>>I need to designate a few property files within the configuration as
> 
> 
>>reloadable.
> 
> 
> 
>>But, when I try to use the following form of Configuration, the files
> 
> 
>>are not marked Reloadable.
> 
> 
> 
>>I find the reloading strategy for the files to be marked as
> 
> 
>>InvariantReloadingStrategy.
> 
> 
> 
>> 
> 
> 
> 
>>Sample Config file
> 
> 
> 
>><-
> 
> 
> <file:///C:\Documents%20and%20Settings\ROHSHARMlocal\Local%20Settings\Te
> 
> 
>>mporary%20Internet%20Files\OLK4\commons_mc.xml##>  <configuration>
> 
> 
> 
>><  <system /> 
> 
> 
> 
>>-
> 
> 
> <file:///C:\Documents%20and%20Settings\ROHSHARMlocal\Local%20Settings\Te
> 
> 
>>mporary%20Internet%20Files\OLK4\commons_mc.xml##>  <!-- 
> 
> 
> 
>>      property file list
> 
> 
>>      
> 
> 
> 
>>  --> 
> 
> 
> 
>>  <  properties fileName="test1_reloadable.properties"
> 
> 
>>reloadable="true"/> 
> 
> 
> 
>>  </configuration>
> 
> 
> 
>> 
> 
> 
> 
>>Any suggestions?
> 
> 
> 
>>____________________________________________
> 
> 
> 
>>Rohit Sharma / Capgemini / Dallas
> 
> 
>>Consultant
> 
> 
> 
>>Mobile: +1 213-291-4417 / www.capgemini.com
> 
> 
> 
>>Join the Collaborative Business Experience
> 
> 
>>____________________________________________
> 
> 
> 
>> 
> 
> 
> ConfigurationFactory does not support specifying reloading strategies. 
> 
> You have to use DefaultConfigurationBuilder instead. Details can be 
> 
> found in the user guide [1]. There is also an example of defining a 
> 
> reloading strategy.
> 
>  
> 
> Oliver
> 
>  
> 
> [1] 
> 
> http://jakarta.apache.org/commons/configuration/howto_configurationbuild
> er.html#Using_DefaultConfigurationBuilder
> 
>  
> 
> ---------------------------------------------------------------------
> 
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> 
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>  
> 
> 
> 
> This message contains information that may be privileged or confidential and is the property
of the Capgemini Group. It is intended only for the person to whom it is addressed. If you
are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,
 distribute, or use this message or any part thereof. If you receive this  message in error,
please notify the sender immediately and delete all  copies of this message.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message