org.springframework.beans.factory.BeanDefinitionStoreException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Tested with M2 and M3 20070801.023929-78 My metadata description looks as follows: <?xml version="1.0" encoding="UTF-8"?> <metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> <OCD id="spring.helloworld.translation.metadata" name="TranslationService-Konfiguration" description="Die Konfiguration des TranslationService"> <AD id="translation.language" type="String" default="de" name="Sprache" description="Der Sprach-Code des TranslationService" cardinality="0"> <Option label="deutsch" value="de" /> <Option label="english" value="en" /> </AD> <AD id="translation.country" type="String" default="DE" name="Land" description="Der Laender-Code des TranslationService" cardinality="0"> <Option label="Deutschland" value="DE" /> <Option label="USA" value="US" /> </AD> </OCD> <Designate pid="spring.helloworld.translation.MetadataProvider"> <Object ocdref="spring.helloworld.translation.metadata" /> </Designate> </metatype:MetaData> The bean.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.0-m3.xsd"> <osgi:property-placeholder persistent-id="spring.helloworld.translation.metadata" /> <bean id="translationService" class="spring.helloworld.internal.translation.TranslationServiceImpl"> <constructor-arg value="${translation.language}"></constructor-arg> <constructor-arg value="${translation.country}"></constructor-arg> </bean> <osgi:service ref="translationService" interface="spring.helloworld.translation.TranslationService"> </osgi:service> <osgi:config id="myAppProperties" persistent-id="spring.helloworld.translation.metadata"> <osgi:config-listener ref="translationService" update-method="updateProperties" /> </osgi:config> </beans> osgi:config is working OK, but osgi:property-placeholder does not work. I am getting the following stack trace: org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'translationService' defined in OSGi res[/META-INF/spring/beans.xml|id=23|symName=spring.helloworld.translation]: Could not resolve placeholder 'translation.language' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467) at org.springframework.osgi.context.support.AbstractRefreshableOsgiBundleApplicationContext.preRefresh(AbstractRefreshableOsgiBundleApplicationContext.java:404) at org.springframework.osgi.extender.support.ServiceDependentOsgiBundleXmlApplicationContext.refresh(ServiceDependentOsgiBundleXmlApplicationContext.java:81) at org.springframework.osgi.extender.ContextLoaderListener$1.run(ContextLoaderListener.java:408) at java.lang.Thread.run(Unknown Source) Kind regards, Bernd
    via by Bernd Kolb,
  • Tested with M2 and M3 20070801.023929-78 My metadata description looks as follows: <?xml version="1.0" encoding="UTF-8"?> <metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> <OCD id="spring.helloworld.translation.metadata" name="TranslationService-Konfiguration" description="Die Konfiguration des TranslationService"> <AD id="translation.language" type="String" default="de" name="Sprache" description="Der Sprach-Code des TranslationService" cardinality="0"> <Option label="deutsch" value="de" /> <Option label="english" value="en" /> </AD> <AD id="translation.country" type="String" default="DE" name="Land" description="Der Laender-Code des TranslationService" cardinality="0"> <Option label="Deutschland" value="DE" /> <Option label="USA" value="US" /> </AD> </OCD> <Designate pid="spring.helloworld.translation.MetadataProvider"> <Object ocdref="spring.helloworld.translation.metadata" /> </Designate> </metatype:MetaData> The bean.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.0-m3.xsd"> <osgi:property-placeholder persistent-id="spring.helloworld.translation.metadata" /> <bean id="translationService" class="spring.helloworld.internal.translation.TranslationServiceImpl"> <constructor-arg value="${translation.language}"></constructor-arg> <constructor-arg value="${translation.country}"></constructor-arg> </bean> <osgi:service ref="translationService" interface="spring.helloworld.translation.TranslationService"> </osgi:service> <osgi:config id="myAppProperties" persistent-id="spring.helloworld.translation.metadata"> <osgi:config-listener ref="translationService" update-method="updateProperties" /> </osgi:config> </beans> osgi:config is working OK, but osgi:property-placeholder does not work. I am getting the following stack trace: org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'translationService' defined in OSGi res[/META-INF/spring/beans.xml|id=23|symName=spring.helloworld.translation]: Could not resolve placeholder 'translation.language' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467) at org.springframework.osgi.context.support.AbstractRefreshableOsgiBundleApplicationContext.preRefresh(AbstractRefreshableOsgiBundleApplicationContext.java:404) at org.springframework.osgi.extender.support.ServiceDependentOsgiBundleXmlApplicationContext.refresh(ServiceDependentOsgiBundleXmlApplicationContext.java:81) at org.springframework.osgi.extender.ContextLoaderListener$1.run(ContextLoaderListener.java:408) at java.lang.Thread.run(Unknown Source) Kind regards, Bernd
    via by Bernd Kolb,
  • Also discussed here: http://forum.springframework.org/showthread.php?t=49973 A nested property in Srping config like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders" value="false" /> <property name="location" value="classpath:org/rbram/docpublisher/changeowner/changeowner.properties" /> </bean> <bean name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close"> <property name="driverClassName"> <value>${${environment}.dataSource.driverClassName}</value> </property> <property name="url"> <value>${${environment}.dataSource.url}</value> </property> <property name="username"> <value>${${environment}.dataSource.username}</value> </property> <property name="password"> <value>${${environment}.dataSource.password}</value> </property> </bean> </beans> With a property file like this: # Environment: local, dev, test, svt or prod. environment=prod prod.dataSource.url=jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=uporac01vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=uporac02vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=uporac03vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=uporac04vip)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORPCORE.cmltd.net.au))) prod.dataSource.username=DOCPUBLISHER_PROD prod.dataSource.password=wescoles07 prod.dataSource.driverClassName=oracle.jdbc.driver.OracleDriver I get this stack trace: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [org/rbram/docpublisher/changeowner/changeOwnerPubApplicationContext.xml]: Could not resolve placeholder '${environment' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:252) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:542) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:516)changeowner.DocumentOwnerChangerSpring(139) - Problem running Document Owner Changer. Rolling back. org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [org/rbram/docpublisher/changeowner/changeOwnerPubApplicationContext.xml]: Could not resolve placeholder '${environment' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:252) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:542) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:516) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:123) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66) at org.rbram.docpublisher.changeowner.DocumentOwnerChangerSpring.run(DocumentOwnerChangerSpring.java:115) at org.rbram.docpublisher.changeowner.DocumentOwnerChangerSpring.main(DocumentOwnerChangerSpring.java:99) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:123) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66) at org.rbram.docpublisher.changeowner.DocumentOwnerChangerSpring.run(DocumentOwnerChangerSpring.java:115) at org.rbram.docpublisher.changeowner.DocumentOwnerChangerSpring.main(DocumentOwnerChangerSpring.java:99) But the parseStringValue() method in PropertyPlaceholderConfigurer indicates that the logic should recursively evaluate nested properties. Setting ignoreUnresolvablePlaceholders to true just leaves me with literal i.e. unresolves values ${${environment}.dataSource.driverClassName} etc..
    via by Robert Mark Bram,
  • Also discussed here: http://forum.springframework.org/showthread.php?t=49973 A nested property in Srping config like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders" value="false" /> <property name="location" value="classpath:org/rbram/docpublisher/changeowner/changeowner.properties" /> </bean> <bean name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close"> <property name="driverClassName"> <value>${${environment}.dataSource.driverClassName}</value> </property> <property name="url"> <value>${${environment}.dataSource.url}</value> </property> <property name="username"> <value>${${environment}.dataSource.username}</value> </property> <property name="password"> <value>${${environment}.dataSource.password}</value> </property> </bean> </beans> With a property file like this: # Environment: local, dev, test, svt or prod. environment=prod prod.dataSource.url=jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=uporac01vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=uporac02vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=uporac03vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=uporac04vip)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORPCORE.cmltd.net.au))) prod.dataSource.username=DOCPUBLISHER_PROD prod.dataSource.password=wescoles07 prod.dataSource.driverClassName=oracle.jdbc.driver.OracleDriver I get this stack trace: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [org/rbram/docpublisher/changeowner/changeOwnerPubApplicationContext.xml]: Could not resolve placeholder '${environment' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:252) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:542) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:516)changeowner.DocumentOwnerChangerSpring(139) - Problem running Document Owner Changer. Rolling back. org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [org/rbram/docpublisher/changeowner/changeOwnerPubApplicationContext.xml]: Could not resolve placeholder '${environment' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:252) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:542) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:516) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:123) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66) at org.rbram.docpublisher.changeowner.DocumentOwnerChangerSpring.run(DocumentOwnerChangerSpring.java:115) at org.rbram.docpublisher.changeowner.DocumentOwnerChangerSpring.main(DocumentOwnerChangerSpring.java:99) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:123) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66) at org.rbram.docpublisher.changeowner.DocumentOwnerChangerSpring.run(DocumentOwnerChangerSpring.java:115) at org.rbram.docpublisher.changeowner.DocumentOwnerChangerSpring.main(DocumentOwnerChangerSpring.java:99) But the parseStringValue() method in PropertyPlaceholderConfigurer indicates that the logic should recursively evaluate nested properties. Setting ignoreUnresolvablePlaceholders to true just leaves me with literal i.e. unresolves values ${${environment}.dataSource.driverClassName} etc..
    via by Robert Mark Bram,
  • The standard Spring placeholder mechanism fails to work. For example, in {noformat} <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>proxy.properties</value> </list> </property> </bean> <http:connector name="httpConnector" clientSoTimeout="1234" cookieSpec="netscape" proxyHostname="${proxyHostname}" proxyPassword="${proxyPassword}" proxyPort="2345" proxyUsername="${proxyUsername}" receiveBacklog="34" receiveBufferSize="4567" sendBufferSize="5678" socketSoLinger="6789" serverSoTimeout="7890" enableCookies="true" keepAlive="true" keepSendSocketOpen="true" sendTcpNoDelay="true" validateConnections="false" /> {noformat} We get the error: {noformat} org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'httpConnector' defined in null: Could not resolve placeholder 'proxyHostname' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334) at org.mule.config.spring.MuleApplicationContext.<init>(MuleApplicationContext.java:62) at org.mule.config.spring.MuleApplicationContext.<init>(MuleApplicationContext.java:54) at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXmlConfigurationBuilder.java:120) at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXmlConfigurationBuilder.java:72) at org.mule.tck.FunctionalTestCase.createManagementContext(FunctionalTestCase.java:44) at org.mule.tck.AbstractMuleTestCase.setUp(AbstractMuleTestCase.java:223) at org.mule.tck.AbstractMuleTestCase.runBare(AbstractMuleTestCase.java:175) at org.mule.tck.AbstractMuleTestCase.run(AbstractMuleTestCase.java:145) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) {noformat}
    via by andrew cooke,
  • The standard Spring placeholder mechanism fails to work. For example, in {noformat} <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>proxy.properties</value> </list> </property> </bean> <http:connector name="httpConnector" clientSoTimeout="1234" cookieSpec="netscape" proxyHostname="${proxyHostname}" proxyPassword="${proxyPassword}" proxyPort="2345" proxyUsername="${proxyUsername}" receiveBacklog="34" receiveBufferSize="4567" sendBufferSize="5678" socketSoLinger="6789" serverSoTimeout="7890" enableCookies="true" keepAlive="true" keepSendSocketOpen="true" sendTcpNoDelay="true" validateConnections="false" /> {noformat} We get the error: {noformat} org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'httpConnector' defined in null: Could not resolve placeholder 'proxyHostname' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334) at org.mule.config.spring.MuleApplicationContext.<init>(MuleApplicationContext.java:62) at org.mule.config.spring.MuleApplicationContext.<init>(MuleApplicationContext.java:54) at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXmlConfigurationBuilder.java:120) at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXmlConfigurationBuilder.java:72) at org.mule.tck.FunctionalTestCase.createManagementContext(FunctionalTestCase.java:44) at org.mule.tck.AbstractMuleTestCase.setUp(AbstractMuleTestCase.java:223) at org.mule.tck.AbstractMuleTestCase.runBare(AbstractMuleTestCase.java:175) at org.mule.tck.AbstractMuleTestCase.run(AbstractMuleTestCase.java:145) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) {noformat}
    via by andrew cooke,
    • org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'translationService' defined in OSGi res[/META-INF/spring/beans.xml|id=23|symName=spring.helloworld.translation]: Could not resolve placeholder 'translation.language' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467) at org.springframework.osgi.context.support.AbstractRefreshableOsgiBundleApplicationContext.preRefresh(AbstractRefreshableOsgiBundleApplicationContext.java:404) at org.springframework.osgi.extender.support.ServiceDependentOsgiBundleXmlApplicationContext.refresh(ServiceDependentOsgiBundleXmlApplicationContext.java:81) at org.springframework.osgi.extender.ContextLoaderListener$1.run(ContextLoaderListener.java:408) at java.lang.Thread.run(Unknown Source)

    Users with the same issue

    oddodd
    16 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    11 more bugmates