[mule-user] expressions conflict with property-placeholder

8 views
Skip to first unread message

Steve A.

unread,
Sep 23, 2008, 5:08:01 PM9/23/08
to us...@mule.codehaus.org

Is there any work-around for the apparent conflict of expressions with
property-placeholders?

e.g. ${header:bar} below causes an error (Could not resolve placeholder
'header:bar'), but if I comment out the <context:property-placeholder>
below, and replace ${foo} below with the literal value, then there is not a
problem.

<context:property-placeholder location = "my.properties"/>
...
<service name = "MyService">
<inbound>
<vm:inbound-endpoint path = "GetMetadata" />
</inbound>
<http:rest-service-component serviceUrl = "${foo}" >
<http:requiredParameter key = "name" value = "${header:bar}" />
</http:rest-service-component>
</service>

Thoughts?

Steve
--
View this message in context: http://www.nabble.com/expressions-conflict-with-property-placeholder-tp19637042p19637042.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Andrew Perepelytsya

unread,
Sep 23, 2008, 5:13:27 PM9/23/08
to us...@mule.codehaus.org
Search the list, you need to configure spring's placeholders to use some other prefix/suffix.

Andrew

Steve A.

unread,
Sep 24, 2008, 9:29:24 AM9/24/08
to us...@mule.codehaus.org

Andrew Perepelytsya wrote:
>
> Search the list, you need to configure spring's placeholders to use some
> other prefix/suffix.
>

Actually, I did search the list prior to posting and saw the prefix
discussion related to using multiple files, but I didn't realize that would
solve my problem too.

Regardless, that worked! Thanks!

I see now a couple other related discussions. Perhaps this should at least
be mentioned in the Mule user guide in the property discussion and/or in the
expressions discussion.

Also, has anyone considered changing the Mule expression prefix (e.g. "$${")
since the Spring property-placeholder is commonly used?

Steve
--
View this message in context: http://www.nabble.com/expressions-conflict-with-property-placeholder-tp19637042p19648904.html

Andrew Perepelytsya

unread,
Sep 24, 2008, 10:17:08 AM9/24/08
to us...@mule.codehaus.org
Steve, could you please post the links to this thread? It would be easier for me then to point our doc guys to this thread and get the job done.

On changing defaults - not sure, ${} became so beloved by everybody :) We could add it to some kind of FAQ, though.

Andrew

Steve A.

unread,
Sep 24, 2008, 10:31:36 AM9/24/08
to us...@mule.codehaus.org

Andrew Perepelytsya wrote:
>
> Steve, could you please post the links to this thread? It would be easier
> for me then to point our doc guys to this thread and get the job done.
> On changing defaults - not sure, ${} became so beloved by everybody :) We
> could add it to some kind of FAQ, though.
>

Sure. I just did a search on "property-placeholder prefix", but the two
most relevant threads are the following:

http://www.nabble.com/Mule-2---property-%24%7BDATE%7D-not-recognized-to18586533.html#a18593210
http://www.nabble.com/2.0.1-spring-config-and-scope-to17468419.html#a17483370.

WRT changing ${}: If property-placeholder wasn't so commonly used, I'd
agree;however, one shouldn't have to change Spring just to use Mule, IMHO.
Besides, $${} isn't really that big of a change. ;-)


--
View this message in context: http://www.nabble.com/expressions-conflict-with-property-placeholder-tp19637042p19650222.html

Andrew Perepelytsya

unread,
Sep 24, 2008, 10:54:58 AM9/24/08
to us...@mule.codehaus.org
Thanks for being helpful ;)


WRT changing ${}:  If property-placeholder wasn't so commonly used, I'd
agree;however, one shouldn't have to change Spring just to use Mule, IMHO.
Besides, $${} isn't really that big of a change. ;-)

Somehow, the odd #{} theme of JSF comes into mind. Ouch :) Anyway, I've filed http://mule.mulesource.org/jira/browse/MULE-3706 for this. We'll definitely discuss it (once we get over the 2.x EE release), but no promises here. It may have a big bang effect. You're always welcome to post suggestions on making it easier on the user, of course :)

Cheers,
Andrew
 

Andrew Perepelytsya

unread,
Sep 24, 2008, 10:58:23 AM9/24/08
to us...@mule.codehaus.org
Just FYI, the doc improvement can be tracked at http://mule.mulesource.org/jira/browse/MULE-3708

HTH,
Andrew

Steve A.

unread,
Sep 25, 2008, 9:16:16 AM9/25/08
to us...@mule.codehaus.org

Steve A. wrote:
>
> Regardless, that worked! Thanks!
>

Apparently, I spoke too soon. :-( It worked for all cases except for any
port attribute substitution which would lead me to believe that it must be
trying to validate the attribute type before the substitution occurs.

Check out excerpts from my configuration and resulting errors below.

Thoughts?

Steve
...
<spring:bean id="placeholderConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<spring:property name="location" value="mule.properties" />
<spring:property name="placeholderPrefix" value="$${" />
</spring:bean>
...
<smtp:outbound-endpoint transformer-refs = "ObjectToString
StringToEmailMessage"
from = "$${smtp.from}"
host = "$${smtp.host}"
password = "$${smtp.password}"
port = "$${smtp.port}"
replyTo="$${smtp.replyTo}"
subject = "$${smtp.subject}"
to = "$${smtp.to}"
user = "$${smtp.user}"
/>
...

INFO 2008-09-25 09:06:33,565 [main]
org.springframework.beans.factory.xml.XmlBeanDefinitionReader: Loading XML
bean definitions from URL
[file:/C:/Dev/Workspaces/sanderson/IDP/conf/idp-mule-config.xml]
ERROR 2008-09-25 09:06:34,049 [main]
org.mule.config.builders.AbstractConfigurationBuilder: Configuration with
"org.mule.config.spring.SpringXmlConfigurationBuilder" failed.
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
88 in XML document from URL
[file:/C:/Dev/Workspaces/sanderson/IDP/conf/idp-mule-config.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.3:
'$${smtp.port}' is not a valid value of union type
'substitutablePortNumber'.
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at
org.mule.config.spring.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:216)
at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
at
org.mule.config.spring.MuleApplicationContext.<init>(MuleApplicationContext.java:102)
at
org.mule.config.spring.MuleApplicationContext.<init>(MuleApplicationContext.java:56)
at
org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringParentRegistry(SpringXmlConfigurationBuilder.java:95)
at
org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:71)
at
org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:38)
at
org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
at
org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:107)
at
org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57)
at
org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:38)
at
org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
at
org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:178)
at org.mule.MuleServer.initialize(MuleServer.java:351)
at org.mule.MuleServer.run(MuleServer.java:257)
at org.mule.MuleServer.start(MuleServer.java:244)
at org.mule.MuleServer.main(MuleServer.java:121)
Caused by: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.3:
'$${smtp.port}' is not a valid value of union type
'substitutablePortNumber'.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processOneAttribute(XMLSchemaValidator.java:2748)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2685)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2037)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:705)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2740)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at
org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
... 22 more
--
View this message in context: http://www.nabble.com/expressions-conflict-with-property-placeholder-tp19637042p19669315.html

Andrew Perepelytsya

unread,
Sep 25, 2008, 9:34:19 AM9/25/08
to us...@mule.codehaus.org
Does it work if you change the prefix to something else, e.g. $[ ?

Andrew

Steve A.

unread,
Sep 25, 2008, 10:59:16 AM9/25/08
to us...@mule.codehaus.org

Andrew Perepelytsya wrote:
>
> Does it work if you change the prefix to something else, e.g. $[ ?
>

No. Same problem.

Thoughts?

Steve
--
View this message in context: http://www.nabble.com/expressions-conflict-with-property-placeholder-tp19637042p19671333.html

Leegorous

unread,
Sep 25, 2008, 7:09:50 PM9/25/08
to us...@mule.codehaus.org
Hi,

I got that error too.

--
My Blog:
http://leegorous.net/blog

Andrew Perepelytsya

unread,
Sep 26, 2008, 10:10:23 AM9/26/08
to us...@mule.codehaus.org
We may need to check the internal schema details. Could you please file a jira and assign it to Dan Feist?

Andrew

Steve A.

unread,
Sep 26, 2008, 2:16:53 PM9/26/08
to us...@mule.codehaus.org

Andrew Perepelytsya wrote:
>
> We may need to check the internal schema details. Could you please file a
> jira and assign it to Dan Feist?
>

Done. Ref: http://www.mulesource.org/jira/browse/MULE-3724

However, I don't think I have assigning privileges.

Steve
--
View this message in context: http://www.nabble.com/expressions-conflict-with-property-placeholder-tp19637042p19693814.html

Reply all
Reply to author
Forward
0 new messages