Hi Oliver:
Thank you for clarifying. Incidentally, if you go to the Commons Configuration
home page under Documentation, click 2.1.1 > User’s Guide > Declaring and
Creating Beans > An Example or click
http://commons.apache.org/proper/commons-configuration/userguide/howto_beans.html#An_Example.
The Java code example uses the dot notation:
BeanDeclaration decl = new XMLBeanDeclaration(config,
“gui.windowManager”);
I’d recommend adding a note to the documentation that states the default
expression engine is being used in the example. I think I probably cut and
paste an example that was using the XML path expression engine instead.
Thanks again,
John
> On Oct 28, 2017, at 11:57 AM, Oliver Heger <[email protected]>
> wrote:
>
> Hello,
>
> Am 27.10.2017 um 22:26 schrieb John Boyer:
>> Hello:
>>
>> I’m working on migrating my codebase from Commons Configuration 1.x to 2.x.
>> However, in version 2, I receive an error indicating that the key I used in
>> 1.x is invalid:
>>
>> org.apache.commons.configuration2.ex.ConfigurationRuntimeException:
>> Passed in key must select exactly one node (found 0): ios.invitation
>>
>>
>> —————————————————————————————————————————————————————-
>> The string dump of my XMLConfiguration appears as follows:
>>
>> ios/invitation/@config-class=com.example.email.DefaultEventEmailFormatter
>> ios/invitation/@fileName=request-cancel
>> ios/invitation/@subject=Itty-Bitty Skedi | Invitation
>> ios/invitation/@name=Invitation
>> ios/invitation/@senderFirstName=Itty-Bitty
>> ios/invitation/@shortDescription=You have a new notification waiting for you
>> in the Skedi app.
>> ios/invitation/@[email protected]
>> ios/invitation/@contentType=text/plain
>> ios/invitation/@senderLastName=Skedi
>
> From this dump it looks as if the configuration is using an
> XPathExpressionEngine. Note that the slash is used as separator for
> property keys.
>
>>
>>
>> —————————————————————————————————————————————————————-
>> The XML file is:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <config>
>> <ios>
>> <!-- recipientFullName, toEmailAddress, and body need to be set
>> -->
>> <invitation
>>
>> config-class=“com.example.email.DefaultEventEmailFormatter”
>> contentType="text/plain"
>> fromEmailAddress=“[email protected]”
>> senderFirstName="Itty-Bitty"
>> senderLastName="Skedi"
>> subject="Itty-Bitty Skedi | Invitation"
>> shortDescription="You have a new notification waiting
>> for you in the Skedi app."
>> name="Invitation"
>> fileName="request-cancel"/>
>> </ios>
>> </config>
>>
>> —————————————————————————————————————————————————————-
>> The Java code snippet:
>>
>> XMLConfiguration xmlConfig = builder.getConfiguration();
>> log.info(ConfigurationUtils.toString(xmlConfig));
>>
>> BeanDeclaration decl = new XMLBeanDeclaration(xmlConfig,
>> “ios.invitation”);//where `ios.invitation` is the key
>
> They key you pass to the bean declaration is expressed in terms of the
> default expression engine. To be compliant with the configuration, you
> should use the key "ios/invitation".
>
> I do not know why the problem occurs after you switch to Configuration
> 2.x. But the cause seems to be that the key you use is actually wrong
> because it cannot be interpreted correctly by the expression engine.
>
> Oliver
>
>>
>> —————————————————————————————————————————————————————-
>>
>> Can anyone help me to resolve this problem?
>>
>> Thank you for your time in advance.
>>
>> Regards,
>>
>> John Boyer
>>
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]