spring-batchspring-xd

Exception thrown while deploying spring batch job in SpringXD Singlenode


Exception thrown while deploying spring batch job in SpringXD Singlenode (1.2.0 Distribution)

Please let me know, how this exception can be fixed (or) any further details needed

org.springframework.beans.factory.BeanDefinitionStoreException: Invalid
   bean definition with name 'registrar' defined in class path resource 
   [META-INF/spring-xd/plugins/job/job-module-beans.xml]: 
Could not resolve placeholder 'xd.job.name' in string value "${xd.job.name}"; 
   nested exception is java.lang.IllegalArgumentException: Could not 
   resolve placeholder 'xd.job.name' in string value "${xd.job.name}"

Following are the trace

2015-07-24T15:29:11-0700 1.2.0.RELEASE INFO DeploymentsPathChildrenCache-0 container.DeploymentListener - Deploying module [ModuleDescriptor@6435a6c5 moduleName = 'category', moduleLabel = 'category', group = 'testcategory', sourceChannelName = [null], sinkChannelName = [null], index = 0, type = job, parameters = map['dateFormat' -> 'yyyy-MM-dd', 'makeUnique' -> 'true'], children = list[[empty]]]
2015-07-24T15:29:12-0700 1.2.0.RELEASE WARN DeploymentsPathChildrenCache-0 annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'registrar' defined in class path resource [META-INF/spring-xd/plugins/job/job-module-beans.xml]: Could not resolve placeholder 'xd.job.name' in string value "${xd.job.name}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'xd.job.name' in string value "${xd.job.name}"
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:211) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:162) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
    at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:213) [spring-xd-module-1.2.0.RELEASE.jar:1.2.0.RELEASE]
    at org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217) [spring-xd-dirt-1.2.0.RELEASE.jar:1.2.0.RELEASE]
    at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200) [spring-xd-dirt-1.2.0.RELEASE.jar:1.2.0.RELEASE]
    at org.springframework.xd.dirt.server.container.DeploymentListener.deployModule(DeploymentListener.java:365) [spring-xd-dirt-1.2.0.RELEASE.jar:1.2.0.RELEASE]
    at org.springframework.xd.dirt.server.container.DeploymentListener.deployJobModule(DeploymentListener.java:291) [spring-xd-dirt-1.2.0.RELEASE.jar:1.2.0.RELEASE]
    at org.springframework.xd.dirt.server.container.DeploymentListener.onChildAdded(DeploymentListener.java:181) [spring-xd-dirt-1.2.0.RELEASE.jar:1.2.0.RELEASE]
    at org.springframework.xd.dirt.server.container.DeploymentListener.childEvent(DeploymentListener.java:149) [spring-xd-dirt-1.2.0.RELEASE.jar:1.2.0.RELEASE]
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509) [curator-recipes-2.6.0.jar:na]
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503) [curator-recipes-2.6.0.jar:na]
    at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92) [curator-framework-2.6.0.jar:na]
    at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) [guava-16.0.1.jar:na]
    at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83) [curator-framework-2.6.0.jar:na]
    at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500) [curator-recipes-2.6.0.jar:na]
    at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35) [curator-recipes-2.6.0.jar:na]
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762) [curator-recipes-2.6.0.jar:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_31]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_31]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_31]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_31]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_31]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_31]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'xd.job.name' in string value "${xd.job.name}"

Solution

  • When creating your job, you will usually pass a name and definition argument. The definition will be put in xd.job.name that serves as a placeholder for the current job's name. It will be filled in, for example in job-module-beans.xml, when xd.job.name is referenced.

    Check out this example:

    xd:> job create --name helloWord --definition "hellojob" --deploy
    xd:> job launch helloWord --params {"someStringParam":"foobar","-someOtherParam(long)":"123456"}
    

    Make sure you pass the correct definition when creating your job during deployment.