1

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/@fromEmailAddress=donotreply@example.com
ios/invitation/@contentType=text/plain
ios/invitation/@senderLastName=Skedi

The XML file is:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <ios>
        <invitation
            config-class=“com.example.email.DefaultEventEmailFormatter”
            contentType="text/plain"
            fromEmailAddress=“donotreply@example.com”
            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

Can anyone help me to resolve this problem?

Thank you for your time!

johnnieb
  • 3,982
  • 4
  • 29
  • 32

0 Answers0