When I tried to run the jar executable, I ran into the Circular Placeholder reference exception problem. Here is a detailed exception.
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'postProcessProperties' defined in class path resource [applicationContext.xml]: Circular placeholder reference 'processor.core.poolsize' in property definitions [echo] at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:287) [echo] at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) [echo] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663) [echo] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:638) [echo] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407) [echo] at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) [echo] at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) [echo] at com.autodesk.postprocess.engine.PostProcessEngine.start(PostProcessEngine.java:39) [echo] at com.autodesk.postprocess.engine.PostProcessEngine.main(PostProcessEngine.java:29)
This is a spring application that uses an external properties file to read values ββat startup. Here is the definition of spring. So far this has worked very well.
<bean id="propertyConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_NEVER" /> <property name="ignoreResourceNotFound" value="true" /> <property name="locations"> <list> <value>classpath:/postprocess.properties</value> </list> </property> <property name="properties"> <props> <prop key="processor.core.poolsize">${processor.core.poolsize}</prop> <prop key="processor.max.poolsize">${processor.max.poolsize}</prop> </props> </property> </bean> <bean id="postProcessProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="properties"> <props> <prop key="processor.core.poolsize">${processor.core.poolsize}</prop> <prop key="processor.max.poolsize">${processor.max.poolsize}</prop> <prop key="processor.polling.delay">${processor.polling.delay}</prop> <prop key="processor.polling.period">${processor.polling.period}</prop> </property> </bean>
I am using a shadow plugin to create a jar file. Here is a fragment
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.7.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.test.postprocess.engine.PostProcessEngine</mainClass> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.handlers</resource> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.schemas</resource> </transformer> </transformers> <filters> <filter> <artifact>:</artifact> <excludes> <exclude>META-INF/.SF</exclude> <exclude>META-INF/.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> </configuration> </execution> </executions> </plugin>
I'm not sure what causes this problem, as I used to use a similar pattern in other jar executables.
Any pointer would be appreciated.
thanks
Shamik
source share