Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.jobRepository': Scope 'step' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No context holder available for step scope
- Done
- at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:355)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
- at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
- at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:192)
- at com.sun.proxy.$Proxy1.getLastJobExecution(Unknown Source)
- at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:98)
- at CustomerFileGenerationMain.main(CustomerFileGenerationMain.java:28)
- Caused by: java.lang.IllegalStateException: No context holder available for step scope
- at org.springframework.batch.core.scope.StepScope.getContext(StepScope.java:167)
- at org.springframework.batch.core.scope.StepScope.get(StepScope.java:99)
- at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:340)
- ... 6 more
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:batch="http://www.springframework.org/schema/batch" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
- xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
- <context:property-placeholder location="classpath*:configs/default/scheduler.properties" ignore-unresolvable="true" />
- <bean id="stepScope" class="org.springframework.batch.core.scope.StepScope">
- <property name="autoProxy" value="true"/>
- </bean>
- <bean id="MPDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
- <property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />
- <property name="url" value="jdbc:oracle:thin:@XXXXXXXXXX1" />
- <property name="username" value="XXXXXX"/>
- <property name="password" value="XXXXXXX" />
- </bean>
- <bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
- <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" scope="step">
- <property name="dataSource" ref="MPDataSource" />
- <property name="transactionManager" ref="transactionManager" />
- <property name="databaseType" value="ORACLE" />
- </bean>
- <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
- <property name="jobRepository" ref="jobRepository" />
- </bean>
- <batch:job id="MyJob">
- <batch:step id="initContextStep" next="customerDecision">
- <batch:tasklet ref="AAAATasklet" />
- </batch:step>
- <batch:decision id="customerDecision" decider="customerDecider">
- <batch:next on="FAILURE" to="ABCStep" />
- <batch:next on="SUCCESS" to="ABCCache" />
- </batch:decision>
- <batch:step id="ABCCache" next="masterStep">
- <batch:tasklet ref="ABCLoader" />
- </batch:step>
- <batch:step id="masterStep" next="updateFileStatusStep">
- <partition step="ABCFileStep" partitioner="ABCPartitioner">
- <handler grid-size="40" task-executor="taskExecutor" />
- </partition>
- </batch:step>
- <batch:step id ="ABCStep" next = "updateFileStatusStep">
- <batch:tasklet ref="KKKFileTasklet" />
- </batch:step>
- <batch:step id="updateFileStatusStep" next = "consolidateEmailStep" >
- <batch:tasklet ref="updateStausTasklet" />
- </batch:step>
- <batch:step id="consolidateEmailStep">
- <batch:tasklet ref="consolidatedEmailTasklet" />
- </batch:step>
- </batch:job>
- <bean id="consolidatedEmailTasklet" class="com.test.ConsolidatedEmailTasklet" scope="step">
- <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
- <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
- </bean>
- <bean id="ABCLoader" class="com.test.ABCMappingCache" scope="step">
- <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}"></property>
- </bean>
- <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
- <property name="corePoolSize" value="40" />
- <property name="maxPoolSize" value="40" />
- <property name="allowCoreThreadTimeOut" value="true" />
- </bean>
- <batch:step id="ABCFileStep" xmlns="http://www.springframework.org/schema/batch">
- <batch:tasklet>
- <batch:chunk reader="ABCReader" processor="ABCProcessor" writer="ABCWriter" commit-interval="5000" />
- </batch:tasklet>
- </batch:step>
- <bean id="ABCWriter" class="com.test.writer.ABCWriter" scope="step">
- <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
- <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
- <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}"></property>
- </bean>
- <bean id="ABCMapping" class="com.test.ABCMapping" scope="step">
- <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}"></property>
- </bean>
- <bean id="ABCProcessor" class="com.test.ABCProcessor" scope="step">
- <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
- <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
- </bean>
- <bean id="ABCReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step">
- <property name="dataSource" ref="MPDataSource" />
- <property name="verifyCursorPosition" value="false" />
- <property name="fetchSize" value="500" />
- <property name="sql"><value> <![CDATA[ SELECT * FROM ABC ]]></value></property>
- <property name="rowMapper">
- <bean class="com.test.ABCRowMapper" />
- </property>
- <property name="preparedStatementSetter" ref="statementSetter" />
- </bean>
- <bean id="statementSetter" class="org.springframework.batch.core.resource.ListPreparedStatementSetter" scope="step">
- <property name="parameters">
- <list>
- <value>#{stepExecutionContext[ica]}</value>
- <value>#{stepExecutionContext[histDays]}</value>
- </list>
- </property>
- </bean>
- <bean id="ABCPartitioner" class="com.test.ABCPartitioner" scope="step">
- <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}" />
- </bean>
- <bean id="generateFileScheduler" class="com.test.GenerateFileScheduler" />
- <bean id="fileGenerationDAO" class="com.test.FileGenerationRulesDao">
- <constructor-arg name="dataSource" ref="MPDataSource" />
- </bean>
- <bean id="ABCExclusionDAO" class="com.mastercard.ess.eds.core.dao.ABCExclusionDAO">
- <constructor-arg name="dataSource" ref="MPDataSource" />
- </bean>
- <task:scheduled-tasks>
- <task:scheduled ref="OOOScheduler" method="updateCache" cron="0 0 0/1 * * ?" />
- </task:scheduled-tasks>
- <bean id="OOOScheduler"
- class="com.test.FileGenerationRulesCache">
- </bean>
- <task:scheduled-tasks>
- <task:scheduled ref="VVVVCacheScheduler" method="updateListOfExcludedBrands" cron="0 0 0/1 * * ?" />
- </task:scheduled-tasks>
- <bean id="VVVVCacheScheduler" class="com.test.BrandExclusionCache"></bean>
- <bean id="lastBatchJobRunDao" class="com.test.dao.LastBatchJobRunDao">
- <constructor-arg name="dataSource" ref="MPDataSource" />
- </bean>
- <bean id="DDDStausTasklet" class="com.test.DDDStausTasklet" scope="step" >
- <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
- <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
- </bean>
- <bean id="KKKFileTasklet" class="com.Testtasklet.KKKFileTasklet" scope="step">
- <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
- <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
- <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}"></property>
- </bean>
- <bean id="customerDecider" class ="com.test.CustomerDecider" />
- </beans>
Add Comment
Please, Sign In to add comment