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: [configuration] Problem Migrating from 1.x to 2.x, my XMLBeanDeclaration is key no Longer Valid
Date Sat, 28 Oct 2017 18:57:39 GMT
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/@fromEmailAddress=donotreply@example.com
> 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=“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

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: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 

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


Mime
View raw message