apache-commons-config

Simple Apache-commons configuration example throws ConfigurationRuntimeException

跟風遠走 提交于 2019-12-22 18:44:31
问题 I'm trying to test a very simple example given in the Apache-commons configuration library user's guide regarding declaring and creating beans. I copied the code in the example almost word by word, and yet I'm getting a ConfigurationRuntimeException (this after overcoming a different exception, see this question). Here is the xml file I'm using - windowcongif.xml : <?xml version="1.0" encoding="ISO-8859-1" ?> <config> <gui> <windowManager config-class="test.DefaultWindowManager" closable=

Very simple Apache-commons configuration example throws NoClassDefFoundError

偶尔善良 提交于 2019-12-18 18:47:56
问题 I'm trying to test a very simple example given in the Apache-commons configuration library user's guide regarding declaring and creating beans. I copied the code in the example almost word by word, and yet I'm getting a NoClassDefFoundError exception. Here is the xml file I'm using - windowcongif.xml : <?xml version="1.0" encoding="ISO-8859-1" ?> <config> <gui> <windowManager config-class="test.DefaultWindowManager" closable="false" resizable="true" defaultWidth="400" defaultHeight="250"> <

How to write multiple line property value using PropertiesConfiguration?

心已入冬 提交于 2019-12-17 17:54:11
问题 I have a properties file with a property with a List value (comma separated), how to write this property in a multi-line ? (backslash after the comma)? I can't find anything about this or at least about escaping comma to comma and backslash. 回答1: If you mean the following; that just relies on backslash + end-of-line. I just found it documented in: http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html primes = 2,\ 3,\ 5,\ 7,\ 11 回答2: Check the User Guide for Properties files:

What going wrong in using PropertiesConfiguration?

只谈情不闲聊 提交于 2019-12-13 16:18:23
问题 For updating in my .properties file I am using Apache Commons Configuration's PropertiesConfiguration. But as I am using the code as : try { PropertiesConfiguration properties = new PropertiesConfiguration("dao.properties"); } catch (ConfigurationException ex) { } I am getting this error: incompatible types required: java.lang.Throwable found: org.apache.commons.configuration.ConfigurationException What is going wrong here? I am using it first for the first time. P.S.: Is there any

Store properties in database, but override locally

一世执手 提交于 2019-12-12 05:19:22
问题 Currently, we store our application's environment properties in a .properties file in the WEB-INF. We want to move them to a database table. But we still want to specify the jndi name, and when running in our test environment locally, we want to be able to override certain properties just for our workspace for test and development. Apache commons' DatabaseConfigurator seemed nice, but wouldn't play nice with the jndi name being defined as a property in the file. Nothing I did to ask it to

Updating config file inside a jar programatically

可紊 提交于 2019-12-12 02:05:40
问题 I'm writing a converter which should convert file A to file B. Doing so, I'm using the config API from Apache Commons Configuration to filter those files so not every entry will be converted. Now I made a jar file which has the config file inside it. Reading from this config file inside the jar is no problem but if I try to use the save() method I'll get a ConfigurationException: no file name has been set message. If I try to set the file name programmatically the program throws a

Using Apache Commons Configuration to do variable interpolation, i.e. ${variable}, with a list of values in a properties file

僤鯓⒐⒋嵵緔 提交于 2019-12-10 13:48:50
问题 I am using Apache Commons Configuration to read a properties file, and I am perfectly able to do variable interpolation, and also to retrieve multi-valued properties as a list. However, I haven't been able to correctly load a property which has several values, where one of them is a reference (variable interpolation) to another multi-valued property. Here's an example of my properties file (I have also tried using comma-separated syntax): doc.mime=application/msword doc.mime=application/vnd

Passing Variable “aaa.bbb” into a Docker Container Process

瘦欲@ 提交于 2019-12-08 12:43:38
问题 Update: the question initially assumed this issue was related to Apache Commons Config behavior. I have updated the question and title to narrow the focus of the question. I am working with the following Apache commons config setup. This setup allows system properties and/or environment variables to override config file properties. I have a number of config file properties with values like "dspace.url". When testing this application in Docker, it would be very convenient to override these

Format XML output with apache commons configuration XMLConfiguration

筅森魡賤 提交于 2019-12-07 03:10:18
问题 I am using the apache commons configuration XMLConfiguration to build and save an XML file. When saving there is no formatting. I get something like: <root> <node> <child> </child> </node> </root> I know there are plenty of ways to use some other library to take that output and format it, but surely there must be a way to set something as simple as indention from commons configuration? 回答1: Encountered the same issue. Although the question was asked long time ago, would like to share a

Simple Apache-commons configuration example throws ConfigurationRuntimeException

女生的网名这么多〃 提交于 2019-12-06 09:45:47
I'm trying to test a very simple example given in the Apache-commons configuration library user's guide regarding declaring and creating beans. I copied the code in the example almost word by word, and yet I'm getting a ConfigurationRuntimeException (this after overcoming a different exception, see this question ). Here is the xml file I'm using - windowcongif.xml : <?xml version="1.0" encoding="ISO-8859-1" ?> <config> <gui> <windowManager config-class="test.DefaultWindowManager" closable="false" resizable="true" defaultWidth="400" defaultHeight="250"> </windowManager> </gui> </config> Here is