Guest User

Untitled

a guest
Jun 26th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.60 KB | None | 0 0
  1. 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
  2. Done
  3. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:355)
  4. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
  5. at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
  6. at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:192)
  7. at com.sun.proxy.$Proxy1.getLastJobExecution(Unknown Source)
  8. at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:98)
  9. at CustomerFileGenerationMain.main(CustomerFileGenerationMain.java:28)
  10. Caused by: java.lang.IllegalStateException: No context holder available for step scope
  11. at org.springframework.batch.core.scope.StepScope.getContext(StepScope.java:167)
  12. at org.springframework.batch.core.scope.StepScope.get(StepScope.java:99)
  13. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:340)
  14. ... 6 more
  15.  
  16. <beans xmlns="http://www.springframework.org/schema/beans"
  17. xmlns:batch="http://www.springframework.org/schema/batch" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  18. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  19. xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
  20. xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
  21. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  22. http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
  23. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  24. http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
  25. http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
  26.  
  27. <context:property-placeholder location="classpath*:configs/default/scheduler.properties" ignore-unresolvable="true" />
  28.  
  29. <bean id="stepScope" class="org.springframework.batch.core.scope.StepScope">
  30. <property name="autoProxy" value="true"/>
  31. </bean>
  32.  
  33. <bean id="MPDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
  34. <property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />
  35. <property name="url" value="jdbc:oracle:thin:@XXXXXXXXXX1" />
  36. <property name="username" value="XXXXXX"/>
  37. <property name="password" value="XXXXXXX" />
  38. </bean>
  39.  
  40. <bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
  41.  
  42. <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean" scope="step">
  43. <property name="dataSource" ref="MPDataSource" />
  44. <property name="transactionManager" ref="transactionManager" />
  45. <property name="databaseType" value="ORACLE" />
  46. </bean>
  47.  
  48. <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
  49. <property name="jobRepository" ref="jobRepository" />
  50. </bean>
  51.  
  52.  
  53. <batch:job id="MyJob">
  54. <batch:step id="initContextStep" next="customerDecision">
  55. <batch:tasklet ref="AAAATasklet" />
  56. </batch:step>
  57. <batch:decision id="customerDecision" decider="customerDecider">
  58. <batch:next on="FAILURE" to="ABCStep" />
  59. <batch:next on="SUCCESS" to="ABCCache" />
  60. </batch:decision>
  61. <batch:step id="ABCCache" next="masterStep">
  62. <batch:tasklet ref="ABCLoader" />
  63. </batch:step>
  64.  
  65. <batch:step id="masterStep" next="updateFileStatusStep">
  66. <partition step="ABCFileStep" partitioner="ABCPartitioner">
  67. <handler grid-size="40" task-executor="taskExecutor" />
  68. </partition>
  69. </batch:step>
  70.  
  71. <batch:step id ="ABCStep" next = "updateFileStatusStep">
  72. <batch:tasklet ref="KKKFileTasklet" />
  73. </batch:step>
  74.  
  75. <batch:step id="updateFileStatusStep" next = "consolidateEmailStep" >
  76. <batch:tasklet ref="updateStausTasklet" />
  77. </batch:step>
  78.  
  79. <batch:step id="consolidateEmailStep">
  80. <batch:tasklet ref="consolidatedEmailTasklet" />
  81. </batch:step>
  82. </batch:job>
  83.  
  84.  
  85. <bean id="consolidatedEmailTasklet" class="com.test.ConsolidatedEmailTasklet" scope="step">
  86. <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
  87. <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
  88. </bean>
  89.  
  90. <bean id="ABCLoader" class="com.test.ABCMappingCache" scope="step">
  91. <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}"></property>
  92. </bean>
  93.  
  94. <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
  95. <property name="corePoolSize" value="40" />
  96. <property name="maxPoolSize" value="40" />
  97. <property name="allowCoreThreadTimeOut" value="true" />
  98. </bean>
  99.  
  100.  
  101. <batch:step id="ABCFileStep" xmlns="http://www.springframework.org/schema/batch">
  102. <batch:tasklet>
  103. <batch:chunk reader="ABCReader" processor="ABCProcessor" writer="ABCWriter" commit-interval="5000" />
  104. </batch:tasklet>
  105. </batch:step>
  106.  
  107. <bean id="ABCWriter" class="com.test.writer.ABCWriter" scope="step">
  108. <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
  109. <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
  110. <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}"></property>
  111. </bean>
  112.  
  113. <bean id="ABCMapping" class="com.test.ABCMapping" scope="step">
  114. <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}"></property>
  115. </bean>
  116.  
  117. <bean id="ABCProcessor" class="com.test.ABCProcessor" scope="step">
  118. <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
  119. <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
  120. </bean>
  121.  
  122. <bean id="ABCReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step">
  123. <property name="dataSource" ref="MPDataSource" />
  124. <property name="verifyCursorPosition" value="false" />
  125. <property name="fetchSize" value="500" />
  126. <property name="sql"><value> <![CDATA[ SELECT * FROM ABC ]]></value></property>
  127.  
  128. <property name="rowMapper">
  129. <bean class="com.test.ABCRowMapper" />
  130. </property>
  131. <property name="preparedStatementSetter" ref="statementSetter" />
  132. </bean>
  133.  
  134. <bean id="statementSetter" class="org.springframework.batch.core.resource.ListPreparedStatementSetter" scope="step">
  135. <property name="parameters">
  136. <list>
  137. <value>#{stepExecutionContext[ica]}</value>
  138. <value>#{stepExecutionContext[histDays]}</value>
  139. </list>
  140. </property>
  141. </bean>
  142.  
  143.  
  144. <bean id="ABCPartitioner" class="com.test.ABCPartitioner" scope="step">
  145. <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}" />
  146. </bean>
  147.  
  148. <bean id="generateFileScheduler" class="com.test.GenerateFileScheduler" />
  149.  
  150. <bean id="fileGenerationDAO" class="com.test.FileGenerationRulesDao">
  151. <constructor-arg name="dataSource" ref="MPDataSource" />
  152. </bean>
  153.  
  154. <bean id="ABCExclusionDAO" class="com.mastercard.ess.eds.core.dao.ABCExclusionDAO">
  155. <constructor-arg name="dataSource" ref="MPDataSource" />
  156. </bean>
  157.  
  158. <task:scheduled-tasks>
  159. <task:scheduled ref="OOOScheduler" method="updateCache" cron="0 0 0/1 * * ?" />
  160. </task:scheduled-tasks>
  161.  
  162. <bean id="OOOScheduler"
  163. class="com.test.FileGenerationRulesCache">
  164. </bean>
  165.  
  166. <task:scheduled-tasks>
  167. <task:scheduled ref="VVVVCacheScheduler" method="updateListOfExcludedBrands" cron="0 0 0/1 * * ?" />
  168. </task:scheduled-tasks>
  169.  
  170. <bean id="VVVVCacheScheduler" class="com.test.BrandExclusionCache"></bean>
  171.  
  172. <bean id="lastBatchJobRunDao" class="com.test.dao.LastBatchJobRunDao">
  173. <constructor-arg name="dataSource" ref="MPDataSource" />
  174. </bean>
  175.  
  176. <bean id="DDDStausTasklet" class="com.test.DDDStausTasklet" scope="step" >
  177. <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
  178. <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
  179. </bean>
  180.  
  181. <bean id="KKKFileTasklet" class="com.Testtasklet.KKKFileTasklet" scope="step">
  182. <property name="jobInstanceName" value="#{stepExecution.jobExecution.jobInstance.jobName}"></property>
  183. <property name="jobInstanceId" value="#{stepExecution.jobExecution.jobId}"></property>
  184. <property name="executionContext" value="#{stepExecution.jobExecution.executionContext}"></property>
  185. </bean>
  186.  
  187. <bean id="customerDecider" class ="com.test.CustomerDecider" />
  188. </beans>
Add Comment
Please, Sign In to add comment