当前位置: 首页 > 知识库问答 >
问题:

带有远程分区器中参数的Spring Batch JobLauncher

茅高卓
2023-03-14

我开始研究@Michael Minella https://github.com/mminella/learningspringbatch/tree/master/src/remotePartitioning发布的模式

在他的例子中,他用:

java -jar -Dspring.profiles.active=slave target/remote-partitioning-0.0.1-SNAPSHOT.jar

和主人一起:

java -jar -Dspring.profiles.active=master target/remote-partitioning-0.0.1-SNAPSHOT.jar
@Bean
@Profile("master")
public JobExecution setJobLauncher() throws Exception {
    JobParameters jobParameters = new JobParametersBuilder()
            .addLong("time", System.currentTimeMillis()).toJobParameters();

    return jobLauncher.run(job(), jobParameters);
}
2021-07-02 20:00:14.336  INFO 44013 --- [           main] i.s.batch.RemotePartitioningApplication  : Starting RemotePartitioningApplication v0.0.1-SNAPSHOT on markus-p51 with PID 44013 (/home/markus/Documents/LearningSpringBatch-master/src/remotePartitioning/target/remote-partitioning-0.0.1-SNAPSHOT.jar started by markus in /home/markus/Documents/LearningSpringBatch-master/src/remotePartitioning)
2021-07-02 20:00:14.339  INFO 44013 --- [           main] i.s.batch.RemotePartitioningApplication  : The following profiles are active: master
2021-07-02 20:00:15.096  INFO 44013 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2021-07-02 20:00:15.100  INFO 44013 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2021-07-02 20:00:15.106  INFO 44013 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2021-07-02 20:00:15.179  INFO 44013 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.support.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-02 20:00:15.308  INFO 44013 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-02 20:00:15.330  INFO 44013 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2021-07-02 20:00:16.230  INFO 44013 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2021-07-02 20:00:16.235  WARN 44013 --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2021-07-02 20:00:16.510  INFO 44013 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2021-07-02 20:00:16.521  INFO 44013 --- [           main] o.s.b.c.r.s.JobRepositoryFactoryBean     : No database type set, using meta data indicating: MYSQL
2021-07-02 20:00:16.713  INFO 44013 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : No TaskExecutor has been set, defaulting to synchronous executor.
2021-07-02 20:00:16.837  INFO 44013 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] launched with the following parameters: [{time=1625270416098}]
2021-07-02 20:00:16.910  INFO 44013 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Executing step: [step1]
2021-07-02 20:00:16.986 ERROR 44013 --- [           main] o.s.batch.core.step.AbstractStep         : Encountered an error executing step step1 in job job

org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'application.outboundRequests'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers, failedMessage=GenericMessage [payload=StepExecutionRequest: [jobExecutionId=31, stepExecutionId=54, stepName=slaveStep], headers={sequenceNumber=0, correlationId=31:slaveStep, id=effa1b0a-e074-5417-105e-48e8f959cd3b, sequenceSize=4, timestamp=1625270416981}]
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:76) ~[spring-integration-core-5.3.2.RELEASE.jar!/:5.3.2.RELEASE]
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:578) ~[spring-integration-core-5.3.2.RELEASE.jar!/:5.3.2.RELEASE]
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:520) ~[spring-integration-core-5.3.2.RELEASE.jar!/:5.3.2.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187) ~[spring-messaging-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166) ~[spring-messaging-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109) ~[spring-messaging-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:99) ~[spring-messaging-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.batch.integration.partition.MessageChannelPartitionHandler.handle(MessageChannelPartitionHandler.java:228) ~[spring-batch-integration-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.batch.core.partition.support.PartitionStep.doExecute(PartitionStep.java:106) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:208) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:410) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.batch.core.job.SimpleJob.doExecute(SimpleJob.java:136) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:319) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:147) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) ~[spring-core-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:140) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127) ~[spring-batch-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at com.sun.proxy.$Proxy45.run(Unknown Source) ~[na:na]
    at io.spring.batch.configuration.JobConfiguration.setJobLauncher(JobConfiguration.java:121) ~[classes!/:0.0.1-SNAPSHOT]
    at io.spring.batch.configuration.JobConfiguration$$EnhancerBySpringCGLIB$$95086da9.CGLIB$setJobLauncher$8(<generated>) ~[classes!/:0.0.1-SNAPSHOT]
    at io.spring.batch.configuration.JobConfiguration$$EnhancerBySpringCGLIB$$95086da9$$FastClassBySpringCGLIB$$1bf34d85.invoke(<generated>) ~[classes!/:0.0.1-SNAPSHOT]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at io.spring.batch.configuration.JobConfiguration$$EnhancerBySpringCGLIB$$95086da9.setJobLauncher(<generated>) ~[classes!/:0.0.1-SNAPSHOT]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:483) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.3.RELEASE.jar!/:2.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.3.RELEASE.jar!/:2.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.3.RELEASE.jar!/:2.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.3.RELEASE.jar!/:2.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.3.RELEASE.jar!/:2.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.3.RELEASE.jar!/:2.3.3.RELEASE]
    at io.spring.batch.RemotePartitioningApplication.main(RemotePartitioningApplication.java:14) ~[classes!/:0.0.1-SNAPSHOT]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[remote-partitioning-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:109) ~[remote-partitioning-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[remote-partitioning-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[remote-partitioning-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:139) ~[spring-integration-core-5.3.2.RELEASE.jar!/:5.3.2.RELEASE]
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:106) ~[spring-integration-core-5.3.2.RELEASE.jar!/:5.3.2.RELEASE]
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:72) ~[spring-integration-core-5.3.2.RELEASE.jar!/:5.3.2.RELEASE]
    ... 67 common frames omitted

2021-07-02 20:00:16.991  INFO 44013 --- [           main] o.s.batch.core.step.AbstractStep         : Step: [step1] executed in 81ms
2021-07-02 20:00:17.010  INFO 44013 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] completed with the following parameters: [{time=1625270416098}] and the following status: [FAILED] in 131ms
2021-07-02 20:00:17.197  INFO 44013 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'taskScheduler'
2021-07-02 20:00:17.248  INFO 44013 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2021-07-02 20:00:17.248  INFO 44013 --- [           main] o.s.i.channel.PublishSubscribeChannel    : Channel 'application.errorChannel' has 1 subscriber(s).
2021-07-02 20:00:17.248  INFO 44013 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started bean '_org.springframework.integration.errorLogger'
2021-07-02 20:00:17.248  INFO 44013 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Adding {amqp:outbound-gateway:integrationConfiguration.amqpOutboundEndpoint.serviceActivator} as a subscriber to the 'outboundRequests' channel
2021-07-02 20:00:17.248  INFO 44013 --- [           main] o.s.integration.channel.DirectChannel    : Channel 'application.outboundRequests' has 1 subscriber(s).
2021-07-02 20:00:17.248  INFO 44013 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started bean 'integrationConfiguration.amqpOutboundEndpoint.serviceActivator'
2021-07-02 20:00:17.260  INFO 44013 --- [           main] i.s.batch.RemotePartitioningApplication  : Started RemotePartitioningApplication in 3.349 seconds (JVM running for 3.881)
2021-07-02 20:00:17.261  INFO 44013 --- [           main] o.s.b.a.b.JobLauncherApplicationRunner   : Running default command line with: []
2021-07-02 20:00:17.340  INFO 44013 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] launched with the following parameters: [{}]
2021-07-02 20:00:17.355  INFO 44013 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Step already complete or not restartable, so no action to execute: StepExecution: id=12, version=2, name=step1, status=COMPLETED, exitStatus=COMPLETED, readCount=100000, filterCount=0, writeCount=100000 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=104, rollbackCount=0, exitDescription=
2021-07-02 20:00:17.363  INFO 44013 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] completed with the following parameters: [{}] and the following status: [COMPLETED] in 15ms
2021-07-02 20:00:17.371  INFO 44013 --- [extShutdownHook] o.s.i.endpoint.EventDrivenConsumer       : Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2021-07-02 20:00:17.371  INFO 44013 --- [extShutdownHook] o.s.i.channel.PublishSubscribeChannel    : Channel 'application.errorChannel' has 0 subscriber(s).
2021-07-02 20:00:17.371  INFO 44013 --- [extShutdownHook] o.s.i.endpoint.EventDrivenConsumer       : stopped bean '_org.springframework.integration.errorLogger'
2021-07-02 20:00:17.371  INFO 44013 --- [extShutdownHook] o.s.i.endpoint.EventDrivenConsumer       : Removing {amqp:outbound-gateway:integrationConfiguration.amqpOutboundEndpoint.serviceActivator} as a subscriber to the 'outboundRequests' channel
2021-07-02 20:00:17.371  INFO 44013 --- [extShutdownHook] o.s.integration.channel.DirectChannel    : Channel 'application.outboundRequests' has 0 subscriber(s).
2021-07-02 20:00:17.371  INFO 44013 --- [extShutdownHook] o.s.i.endpoint.EventDrivenConsumer       : stopped bean 'integrationConfiguration.amqpOutboundEndpoint.serviceActivator'
2021-07-02 20:00:17.372  INFO 44013 --- [extShutdownHook] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'taskScheduler'
2021-07-02 20:00:17.373  INFO 44013 --- [extShutdownHook] o.s.a.r.l.SimpleMessageListenerContainer : Shutdown ignored - container is not active already
2021-07-02 20:00:17.375  INFO 44013 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2021-07-02 20:00:17.383  INFO 44013 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2021-07-02 20:17:58.894  INFO 45764 --- [           main] i.s.batch.RemotePartitioningApplication  : Starting RemotePartitioningApplication v0.0.1-SNAPSHOT on markus-p51 with PID 45764 (/home/markus/Documents/LearningSpringBatch-master/src/remotePartitioning/target/remote-partitioning-0.0.1-SNAPSHOT.jar started by markus in /home/markus/Documents/LearningSpringBatch-master/src/remotePartitioning)
2021-07-02 20:17:58.898  INFO 45764 --- [           main] i.s.batch.RemotePartitioningApplication  : The following profiles are active: slave
2021-07-02 20:17:59.616  INFO 45764 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2021-07-02 20:17:59.619  INFO 45764 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2021-07-02 20:17:59.624  INFO 45764 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2021-07-02 20:17:59.685  INFO 45764 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.support.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-02 20:17:59.811  INFO 45764 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-02 20:17:59.835  INFO 45764 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2021-07-02 20:18:00.585  INFO 45764 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2021-07-02 20:18:00.590  WARN 45764 --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2021-07-02 20:18:00.832  INFO 45764 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2021-07-02 20:18:00.895  INFO 45764 --- [           main] o.s.b.c.r.s.JobRepositoryFactoryBean     : No database type set, using meta data indicating: MYSQL
2021-07-02 20:18:01.029  INFO 45764 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : No TaskExecutor has been set, defaulting to synchronous executor.
2021-07-02 20:18:01.143  INFO 45764 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'taskScheduler'
2021-07-02 20:18:01.222  INFO 45764 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2021-07-02 20:18:01.222  INFO 45764 --- [           main] o.s.i.channel.PublishSubscribeChannel    : Channel 'application.errorChannel' has 1 subscriber(s).
2021-07-02 20:18:01.222  INFO 45764 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started bean '_org.springframework.integration.errorLogger'
2021-07-02 20:18:01.222  INFO 45764 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Adding {amqp:outbound-gateway:integrationConfiguration.amqpOutboundEndpoint.serviceActivator} as a subscriber to the 'outboundRequests' channel
2021-07-02 20:18:01.222  INFO 45764 --- [           main] o.s.integration.channel.DirectChannel    : Channel 'application.outboundRequests' has 1 subscriber(s).
2021-07-02 20:18:01.222  INFO 45764 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started bean 'integrationConfiguration.amqpOutboundEndpoint.serviceActivator'
2021-07-02 20:18:01.223  INFO 45764 --- [           main] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [localhost:5672]
2021-07-02 20:18:01.300  INFO 45764 --- [           main] o.s.a.r.c.CachingConnectionFactory       : Created new connection: rabbitConnectionFactory#3a5ecce3:0/SimpleConnection@32c0915e [delegate=amqp://guest@127.0.0.1:5672/, localPort= 54076]
2021-07-02 20:18:01.305  INFO 45764 --- [           main] o.s.amqp.rabbit.core.RabbitAdmin         : Auto-declaring a non-durable, auto-delete, or exclusive Queue (partition.requests) durable:false, auto-delete:false, exclusive:false. It will be redeclared if the broker stops and is restarted while the connection factory is alive, but all messages will be lost.
2021-07-02 20:18:01.345  INFO 45764 --- [           main] o.s.i.a.i.AmqpInboundChannelAdapter      : started bean 'inbound'; defined in: 'class path resource [io/spring/batch/configuration/IntegrationConfiguration.class]'; from source: 'org.springframework.core.type.classreading.SimpleMethodMetadata@6107227e'
2021-07-02 20:18:01.347  INFO 45764 --- [           main] o.s.i.endpoint.PollingConsumer           : started bean 'jobConfiguration.stepExecutionRequestHandler.serviceActivator'
2021-07-02 20:18:01.359  INFO 45764 --- [           main] i.s.batch.RemotePartitioningApplication  : Started RemotePartitioningApplication in 2.86 seconds (JVM running for 3.243)
2021-07-02 20:18:01.361  INFO 45764 --- [           main] o.s.b.a.b.JobLauncherApplicationRunner   : Running default command line with: []
2021-07-02 20:18:01.478  INFO 45764 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] launched with the following parameters: [{}]
2021-07-02 20:18:01.520  INFO 45764 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Step already complete or not restartable, so no action to execute: StepExecution: id=12, version=2, name=step1, status=COMPLETED, exitStatus=COMPLETED, readCount=100000, filterCount=0, writeCount=100000 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=104, rollbackCount=0, exitDescription=
2021-07-02 20:18:01.531  INFO 45764 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] completed with the following parameters: [{}] and the following status: [COMPLETED] in 25ms

当试图将参数传递给JobLauncher时,我是否遗漏了任何设置?似乎Spring集成中缺少一个配置。

任何帮助/领导都是感激的。Thx,马库斯。

共有1个答案

富念
2023-03-14

我想把一个参数传递给作业

可以在命令行中将参数作为键/值对传递给作业:

java -jar myjob.jar param1=value1 param2=value2

因此,我将@profile移动到一个@bean,该bean使用一个参数启动作业:

java -jar -Dspring.profiles.active=master target/remote-partitioning-0.0.1-SNAPSHOT.jar time=$(date +%s)
@Bean
@Profile("master")
public JobExecution setJobLauncher() throws Exception {
    JobParameters jobParameters = new JobParametersBuilder()
            .addLong("time", System.currentTimeMillis()).toJobParameters();

    return jobLauncher.run(job(), jobParameters);
}
@Bean
public JobLauncher jobLauncher() {
    SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
    // configure the job launcher as needed
    return jobLauncher;
}
 类似资料:
  • 举一个普通的例子,我从DB2中获取数据,处理数据并将其写入MongoDB。我是用spring batch column range partitioning(远程分区)来实现这一点的,但问题是在我的DB2表中没有顺序列,因此每个分区都有不同的数据计数。因此,每个从机的负载是不同的。我的要求是在奴隶中平均分配负载。

  • 问题内容: Spring Batch远程分块和远程分区有什么区别? 我无法理解Spring Batch中的远程分块和远程分区之间的区别。有人可以解释一下吗? 问题答案: 远程分区 分区是主/从步骤配置,允许并行处理数据分区。每个分区都是通过一些元数据来描述的。例如,如果您正在处理数据库表,则分区1可能是ID 0-100,分区2可能是101-200,等等。对于Spring Batch,主步骤使用分区

  • spring批处理远程分块和远程分区之间有什么区别? 我无法理解spring batch中远程分块和远程分区之间的区别。谁能解释一下吗?

  • 目前,我们正在将批处理作业从java迁移到spring batch。此批处理作业从数据库和web服务获取其输入。我们需要在四台服务器上运行此作业,以提高性能,因为此作业正在处理大量数据。 上述场景是否可以通过spring batch中的远程分区实现? 我浏览了远程分区文档,但它很难理解,我没有找到任何关于远程分区的可靠示例。 请帮帮我。

  • 我的问题是,当没有密钥时,Spark如何重新分区?我无法进一步深入源代码,以找到它通过Spark本身的位置。 例如:调用这些行完全可以,但我不知道它实际上在做什么。是整行的散列吗?也许是DataFrame中的第一列?

  • 问题内容: 我正在阅读Wikipedia上的Singleton文章,并且遇到了以下示例: 虽然我真的很喜欢Singleton的行为方式,但是我看不到如何修改它以将参数合并到构造函数中。用Java进行此操作的首选方法是什么?我需要做这样的事情吗? 谢谢! 编辑:我想我对使用Singleton的渴望已经引发了一场争论的风暴。让我解释一下我的动机,并希望有人可以提出一个更好的主意。我正在使用网格计算框架