My repository for development tidbits, and a few personal anecdotes

Mulitple PropertyPlaceholderConfigurer configurations

Posted by doubleA on September 14, 2007

I ran into an issue today when adding a second Spring propertyConfigerer to my application build. My application uses a multi module Maven build system.

A little background on the Maven config: The modules are configured with a core, a web, and a parent. The web module depends on the parent. I originally had a single propertyConfiguer in the web project and it worked without any issues.

Yesterday, I added a propertyConfigurer to the core project to control some email settings. The configurer works fine when I run the Maven build for only the core module. However, when I run the build and tests from the web module, I was receiving the following error:

org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'userSearch' defined in URL [file:/"path to my applicationContext-wicket.xml file"]: Could not resolve placeholder 'ldap.basedn'

This error is referring to the ldap properties file I have configured in my web project, and I knew that the configuration for the web project had not changed.

After doing some research, I found this post on the spring forums and the fix mentioned worked perfectly.

The fix involves editing the first application context file that is loaded. For my build, this is the core module because it is the lowest level in my build. My updated applicationContext.xml file in my core project looks like this

  1.     <bean id="mailProps" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

  2.         <property name="location" value=""/>

  3.         <property name="ignoreUnresolvablePlaceholders" value="true"/>

  4.     </bean>	

After making the change to set ignoreUnresolvablePlaceholders=true, my build and tests completed successfully.

I found another forum post that mentions a different fix, but I did not try it out because the first fix worked for me. But here is the link in case it helps.

3 Responses to “Mulitple PropertyPlaceholderConfigurer configurations”

  1. Vijay Akkineni said

    Hithat was a great post ….i was really struggling with this issue. Thank you very much .

    • Isha said


      I have same issue, but after I did your modifications,

      I get

      PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘base’ threw exception; nested exception is org.springframework.ldap.BadLdapGrammarException: Failed to parse DN; nested exception is org.springframework.ldap.core.TokenMgrError: Lexical error at line 1, column 1. Encountered: “$” (36), after : “”
      at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(
      at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(
      … 129 more

      Thanks in Advance.

  2. Learn to manage Search engine optimisation WordPress Plugin…

    […]Mulitple PropertyPlaceholderConfigurer configurations « DoTaL[…]…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: