Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 252940

Re: GemFire Not Reading gemfire.properties As Expected

$
0
0

Thanks for the pointers Jens! I was able to get it working. I'm not sure if this is the best way, but it did serve my need. I had to replace "util:properties" with a different way to read in the properties. I had a couple of issues with utils:properties that I couldn't figure out. I needed to specify a file external to "webapps". I played around with trying to use a property to point outside the webapps area, without any luck. I tried things like

 

 

        <util:properties id="props" location="classpath:/${gemfirePropertyDir:}gemfire.properties" />
And then specify -DgemfirePropertyDir=../conf/gemfire.properites on the tcServer startup command line. I tried a few different flavors of the relative path trying to get the correct location. Nothing worked. It kept giving a file not found error. I then expanded the location attribute using a "file:" specification, that allowed an absolute path to be specified.
<util:properties id="props" location="classpath:/gemfire.properties, file:${gemfirePropertyDir:''}" />
The caused a problem when running the tests because the gemfirePropertyDir wasn't defined and as a result the file was not found. It would be nice if util:properties would ignore if a file wasn't found. Which brings me to the solution that does work if a file is not found. Notice the "ignoreResourceNotFound" property.
<bean id="props" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
   <property name="ignoreResourceNotFound"><value>true</value></property>
   <property name="locations">
       <list>
           <value>classpath:/gemfire.properties</value>
           <value>file:${gemfireProperties:}</value>
      </list>
  </property>
</bean>
With this implementation the tests work when building AND I'm able to specify external properties when deployed to tcServer. It seems this is a more real world implementation. What do you think?

Viewing all articles
Browse latest Browse all 252940

Trending Articles