Quantcast

PropertyPlaceholderConfigurer - could not resolve placeholder

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PropertyPlaceholderConfigurer - could not resolve placeholder

Adrian Brenes-2
I'm currently having an issue where I have two separate services that are configured via one mule-config.xml file by using spring-import of each service's xxx-config.xml.  The property placeholder entries are in the Spring applicationContext xml files that these individual services use.

So the scenario is:

mule-config.xml ==> addressValidation-config.xml ==> addressValidation-applicationContext.xml
mule-config.xml ==> mdservices-config.xml ==> applicationContext.xml

The mule-config.xml file looks like this:

 <?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.mulesource.org/schema/mule/core/2.2"
       xmlns:jersey="http://www.mulesource.org/schema/mule/jersey/2.2"
       xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
       xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
       xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
               http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
               http://www.mulesource.org/schema/mule/jersey/2.2 http://www.mulesource.org/schema/mule/jersey/2.2/mule-jersey.xsd
               http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
               http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

  <jersey:connector name="jersey"/>
       
  <spring:beans>
    <!-- spring:import resource="addressValidation-config.xml" /-->

    <spring:import resource="addressValidation-config.xml"/>
    <spring:import resource="mdservices-config.xml"/>
    <spring:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                        <spring:property name="locations">
                                <spring:list>
                                        <spring:value>file:${user.home}/addressServices.properties</spring:value>
                                        <spring:value>file:${user.home}/mds.properties</spring:value>
                                </spring:list>
                        </spring:property>
                </spring:bean>

  </spring:beans>
</mule>

Each of these imported resources, addressValidation-config.xml and mdservices-config.xml have property placeholders in them.  I originally had the property placeholder spring bean defined separately in each of these config files but had the same issue where it can't find the placeholders.  So I put it in here and got the same behavior.  If I comment one import or the other mule will start up fine - finding the placeholder values in the correct properties file.  

This is what one of the imported config files looks like...

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.mulesource.org/schema/mule/core/2.2"
       xmlns:jersey="http://www.mulesource.org/schema/mule/jersey/2.2"
       xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
       xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
       xmlns:http="http://www.mulesource.org/schema/mule/http/2.2"
       xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.2"
       xsi:schemaLocation="
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
               http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
               http://www.mulesource.org/schema/mule/jersey/2.2 http://www.mulesource.org/schema/mule/jersey/2.2/mule-jersey.xsd
               http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
               http://www.mulesource.org/schema/mule/http/2.2 http://www.mulesource.org/schema/mule/http/2.2/mule-http.xsd
               http://www.mulesource.org/schema/mule/xml/2.2 http://www.mulesource.org/schema/mule/xml/2.2/mule-xml.xsd
               http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd">

       
        <spring:beans>
                <spring:import resource="classpath:addressValidation-applicationContext.xml" />
               
                <!-- spring:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                        <spring:property name="locations" value="file:${user.home}/addressServices.properties" />
                </spring:bean-->
               
        </spring:beans>
       
        <model name="AddressTypeRequest">
                <service name="AddressValidator">
                        <inbound>
                <inbound-endpoint address="jersey:http://localhost:65090" synchronous="true"/>
              </inbound>
              <component>      
              <spring-object bean="addressValidatorResource" />
              </component>
                </service>
        </model>
</mule>

The placeholders are in the referenced addressValidation-applicationContext.xml file.  So, the properties files are definitely accessible and each service deployed separately is functional.  I'm running mule 2.2.1 standalone.  Any clues on what configuration has to occur in order to do this?

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PropertyPlaceholderConfigurer - could not resolve placeholder

Adrian Brenes-2
Can any MuleSoft devs comment on this issue?  Any comments on how others are segregating their services with Mule?

Thx,

Jeff

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: PropertyPlaceholderConfigurer - could not resolve placeholder

Andrew Perepelytsya
IIRC, Spring's PropertyPlaceholderConfigurer can only be declared once for an app context. Maybe you can solve it by using wildcard locations as with classpath: entries.

HTH,
Andrew
Loading...