Spring Batch MultiResourceItemReader configuration issue with Custom ItemReader - spring-batch

My current implementation below is working fine as long as in my publicFigureItemReader() I just set the Resource to the file I am trying to read. However, now that I got to this point I am trying to implement a MultiResourceItemReader which it will pass to the publicFigureItemReader() a bunch of files. As I have about 100 files in a single folder.
I have created the MultiResourceItemReader and now if I would use just a classic ItemReader I should just register this into my step .reader(multiResourceItemReader()) but by doing so is not working because I am using a custom ItemReader so I am not sure how to register my MultiResourceItemReader. Any pointers ?
If I try to register like so, the customItemWriter will stop working, I get a null pointer exception.
#Bean
Step associateXmlFileToDatabaseStep() {
return stepBuilderFactory.get("associateXmlFileToDatabaseStep")
.<Associate, Associate>chunk(1000)
.reader(customItemReader())
.writer(associateItemWriter(super.dataSource,super.namedParameterJdbcTemplate))
.stream(multiResourceItemReader())
//.stream((ItemStream) publicFigureItemReader())
.build();
}
If I try without registering the multiResourceItemReader() the exception is obvious java.lang.IllegalArgumentException: The Resource must not be null.
#Bean
Step associateXmlFileToDatabaseStep() {
return stepBuilderFactory.get("associateXmlFileToDatabaseStep")
.<Associate, Associate>chunk(1000)
.reader(customItemReader())
.writer(associateItemWriter(super.dataSource,super.namedParameterJdbcTemplate))
//.stream(multiResourceItemReader())
.stream((ItemStream) publicFigureItemReader())
.build();
}
Here is a copy paste of my current Job Configuration Class.
#Value("classpath*:/data/mydata*.xml")
private Resource[] inputFiles;
#Bean
public MultiResourceItemReader<PublicFigure> multiResourceItemReader() {
MultiResourceItemReader<PublicFigure> reader = new MultiResourceItemReader<>();
reader.setDelegate((ResourceAwareItemReaderItemStream<? extends PublicFigure>) publicFigureItemReader());
reader.setResources(inputFiles);
return reader;
}
#Bean
ItemReader<PublicFigure> publicFigureItemReader() {
StaxEventItemReader<PublicFigure> xmlFileReader = new StaxEventItemReader<>();
//xmlFileReader.setResource(new FileSystemResource("C:\\Users\\da\\myfile1.xml"));
xmlFileReader.setFragmentRootElementName("PublicFigure");
Jaxb2Marshaller publicFigMarshaller = new Jaxb2Marshaller();
publicFigMarshaller.setClassesToBeBound(Associate.class, PublicFigure.class);
publicFigMarshaller.setUnmarshallerListener(new PublicFigureAssociateListener());
xmlFileReader.setUnmarshaller(publicFigMarshaller);
return xmlFileReader;
}
#Bean
ItemReader<Associate> customItemReader() {
return new AssociateItemReader(publicFigureItemReader());
}
#Bean
ItemWriter<Associate> associateItemWriter(DataSource dataSource, NamedParameterJdbcTemplate jdbcTemplate) {
JdbcBatchItemWriter<Associate> databaseItemWriter = new JdbcBatchItemWriter<>();
databaseItemWriter.setDataSource(dataSource);
databaseItemWriter.setJdbcTemplate(jdbcTemplate);
databaseItemWriter.setSql(QUERY_INSERT);
ItemPreparedStatementSetter<Associate> associateItemPreparedStatementSetter = new AssociatePreparedStatementSetter();
databaseItemWriter.setItemPreparedStatementSetter(associateItemPreparedStatementSetter);
return databaseItemWriter;
}
#Bean
Step associateXmlFileToDatabaseStep() {
return stepBuilderFactory.get("associateXmlFileToDatabaseStep")
.<Associate, Associate>chunk(1000)
.reader(customItemReader())
.writer(associateItemWriter(super.dataSource,super.namedParameterJdbcTemplate))
//.stream(multiResourceItemReader())
.stream((ItemStream) publicFigureItemReader())
.build();
}
The above configuration will throw an exception, even after changing the customItemReader to return the multiREsourceItemReader, see below:
#Bean
ItemReader<Associate> customItemReader() {
//return new AssociateItemReader(publicFigureItemReader());
return new AssociateItemReader(multiResourceItemReader());
}
This is the stacktrace as a result
org.springframework.batch.item.ItemStreamException: Failed to initialize the reader
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:147) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:96) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:310) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:197) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:93) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:90) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Caused by: java.lang.IllegalArgumentException: The Resource must not be null.
at org.springframework.util.Assert.notNull(Assert.java:134) ~[spring-core-4.3.17.RELEASE.jar:4.3.17.RELEASE]
at org.springframework.batch.item.xml.StaxEventItemReader.doOpen(StaxEventItemReader.java:189) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:144) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
... 12 common frames omitted
The below stacktrace will come up when I register the multiReader and comment the publicFigureItemReader()), like so:
.stream(multiResourceItemReader())
//.stream((ItemStream) publicFigureItemReader())
-This is the stacktrace:
org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
org.springframework.core.io.Resource is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at org.springframework.core.io.Resource
at private org.springframework.core.io.Resource io.spring.batch.configuration.jobs.djsplit.djpersonsentities.PublicFigure.resource
at io.spring.batch.configuration.jobs.djsplit.djpersonsentities.PublicFigure
at io.spring.batch.configuration.jobs.djsplit.djpersonsentities.PublicFigure io.spring.batch.configuration.jobs.djsplit.djpersonsentities.Associate.publicFigure
at io.spring.batch.configuration.jobs.djsplit.djpersonsentities.Associate
at org.springframework.oxm.jaxb.Jaxb2Marshaller.convertJaxbException(Jaxb2Marshaller.java:915) ~[spring-oxm-4.3.17.RELEASE.jar:4.3.17.RELEASE]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.getJaxbContext(Jaxb2Marshaller.java:483) ~[spring-oxm-4.3.17.RELEASE.jar:4.3.17.RELEASE]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.createUnmarshaller(Jaxb2Marshaller.java:858) ~[spring-oxm-4.3.17.RELEASE.jar:4.3.17.RELEASE]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:761) ~[spring-oxm-4.3.17.RELEASE.jar:4.3.17.RELEASE]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:753) ~[spring-oxm-4.3.17.RELEASE.jar:4.3.17.RELEASE]
at org.springframework.batch.item.xml.StaxEventItemReader.doRead(StaxEventItemReader.java:240) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:88) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.item.file.MultiResourceItemReader.readFromDelegate(MultiResourceItemReader.java:140) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.item.file.MultiResourceItemReader.readNextItem(MultiResourceItemReader.java:119) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.item.file.MultiResourceItemReader.read(MultiResourceItemReader.java:108) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at io.spring.batch.configuration.jobs.djsplit.djpersonsentities.AssociateItemReader.read(AssociateItemReader.java:23) ~[classes/:na]
at io.spring.batch.configuration.jobs.djsplit.djpersonsentities.AssociateItemReader.read(AssociateItemReader.java:11) ~[classes/:na]
at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:91) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:157) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:116) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:110) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:69) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.3.17.RELEASE.jar:4.3.17.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:272) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200) ~[spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:93) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at org.springframework.batch.core.job.flow.support.state.SplitState$1.call(SplitState.java:90) [spring-batch-core-3.0.9.RELEASE.jar:3.0.9.RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91) ~[na:1.8.0_144]
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:445) ~[na:1.8.0_144]
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:277) ~[na:1.8.0_144]
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:124) ~[na:1.8.0_144]
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1123) ~[na:1.8.0_144]
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:147) ~[na:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:247) ~[na:1.8.0_144]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:234) ~[na:1.8.0_144]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:462) ~[na:1.8.0_144]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:641) ~[na:1.8.0_144]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584) ~[na:1.8.0_144]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.createJaxbContextFromClasses(Jaxb2Marshaller.java:523) ~[spring-oxm-4.3.17.RELEASE.jar:4.3.17.RELEASE]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.getJaxbContext(Jaxb2Marshaller.java:476) ~[spring-oxm-4.3.17.RELEASE.jar:4.3.17.RELEASE]
... 37 common frames omitted

Related

org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel- occures before subscriber bean is created

I am trying to implement ReplyingKafkaTemplate with spring batch integration.
It is actually running eagerly and throwing the "Dispatcher has no subscribers for channel" error before the subscriber bean is created. As you can see in the log.
org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'kafka Cloud Task.gatewayinputchannel'.;
Adding {kafka:outbound-gateway:kafkaConfig.outGateway.serviceActivator} as a subscriber to the 'gatewayinputchannel' channel
2022-08-18 02:02:08.068 INFO 24232 --- [ main] o.s.integration.channel.DirectChannel : Channel 'kafka Cloud Task.gatewayinputchannel' has 1 subscriber(s).
2022-08-18 02:02:08.068 INFO 24232 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started bean 'kafkaConfig.outGateway.serviceActivator'
Is there a way to prevent it from running eagerly? and wait till all the beans are created.
My ReplyingKafkaTemplate is described as below.
#Bean
#ServiceActivator(inputChannel = "gatewayinputchannel")
public KafkaProducerMessageHandler<String, Message<?>> outGateway(
ReplyingKafkaTemplate<String, Message<?>, Message<?>> kafkaTemplate) {
KafkaProducerMessageHandler<String,Message<?>> kpmh = new KafkaProducerMessageHandler<String,Message<?>>(kafkaTemplate);
kpmh.setMessageKeyExpression(new LiteralExpression(kafka_processing_topic));
kpmh.setTopicExpression(new LiteralExpression(kafka_processing_topic));
kpmh.setOutputChannel(gatewayoutputchannel());
return kpmh;
}
Edited
#Configuration
#MessagingGateway
#EnableIntegration
#IntegrationComponentScan
public interface IntegrationGateway {
#Gateway(requestChannel = "gatewayinputchannel", replyChannel = "gatewayoutputchannel")
public Message<?> sendToKafka(Message<?> input);
}
We are calling it from the item processor of a batch job
Message<?> request= MessageBuilder.withPayload(inpMessage).copyHeaders(header).build();
Message<?> response = integrationGateway.sendToKafka(request);
-------------------------- Edit 3 --------------------------
How you start the batch job ? :
We are trying to start the batch job from a spring boot project with #Scheduled method programmatically using JobLuncher.
I have below flag to prevent the job starting automatically.
spring.batch.job.enabled=false
2022-08-19 16:00:24.781 ERROR 13732 --- [ task-1] o.s.batch.core.step.AbstractStep : Encountered an error executing step Synchronous Processing : Read -> Process -> Write in job fixedLengthFileJob
org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'IMPF Cloud Task.gatewayinputchannel'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers, failedMessage=GenericMessage [payload=10001,Bruce,S,Willis,M,16/07/1974,#1 1st main,1st cross,Moody,Alabama,#2 2nd main,2nd cross,Acmar,Alabama,Mobile,(205)710-2385,,Landline,(20,01, headers={RunGUID=00a04208-c0d8-4354-97f0-c5d8bfb5368d, replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel#27192c74, errorChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel#27192c74, IngestionPath=/opt/usr/conf/xyz/, id=d52d89f7-4ec0-5c3e-b84b-be4dc58223b5, kafka_replyTopic=impf_int_batch_success, timestamp=1660905024776}]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:76) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:317) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:272) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187) ~[spring-messaging-5.3.16.jar:5.3.16]
at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:233) ~[spring-messaging-5.3.16.jar:5.3.16]
at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:47) ~[spring-messaging-5.3.16.jar:5.3.16]
at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:46) ~[spring-messaging-5.3.16.jar:5.3.16]
at org.springframework.integration.core.MessagingTemplate.sendAndReceive(MessagingTemplate.java:97) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:522) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceiveMessage(MessagingGatewaySupport.java:492) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.gateway.GatewayProxyFactoryBean.sendOrSendAndReceive(GatewayProxyFactoryBean.java:652) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:588) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:555) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:544) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.3.16.jar:5.3.16]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) [spring-aop-5.3.16.jar:5.3.16]
at com.sun.proxy.$Proxy91.sendToKafka(Unknown Source) ~[na:na]
at com.cloudtask.batchconfig.CloudTaskBatchSyncConfig.lambda$syncProcessor$2(CloudTaskBatchSyncConfig.java:204) ~[classes/:na]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.doProcess(SimpleChunkProcessor.java:134) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.transform(SimpleChunkProcessor.java:319) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:210) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:77) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:407) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:331) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.3.16.jar:5.3.16]
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:273) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:82) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:375) ~[spring-batch-infrastructure-4.3.5.jar:4.3.5]
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) ~[spring-batch-infrastructure-4.3.5.jar:4.3.5]
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:145) ~[spring-batch-infrastructure-4.3.5.jar:4.3.5]
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:258) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:208) ~[spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:152) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:68) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:68) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:137) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:320) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:149) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) [spring-core-5.3.16.jar:5.3.16]
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:140) [spring-batch-core-4.3.5.jar:4.3.5]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_331]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_331]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_331]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_331]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) [spring-aop-5.3.16.jar:5.3.16]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) [spring-aop-5.3.16.jar:5.3.16]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.3.16.jar:5.3.16]
at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:128) [spring-batch-core-4.3.5.jar:4.3.5]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.3.16.jar:5.3.16]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) [spring-aop-5.3.16.jar:5.3.16]
at com.sun.proxy.$Proxy93.run(Unknown Source) [na:na]
at com.cloudtask.batchconfig.runner.JobRunner.runJob(JobRunner.java:71) [classes/:na]
at com.cloudtask.batchconfig.runner.JobRunner.runFlatFileBatchJob(JobRunner.java:43) [classes/:na]
at com.cloudtask.batchconfig.runner.JobRunner$$FastClassBySpringCGLIB$$e5597de2.invoke(<generated>) [classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.3.16.jar:5.3.16]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) [spring-aop-5.3.16.jar:5.3.16]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.3.16.jar:5.3.16]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) [spring-aop-5.3.16.jar:5.3.16]
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) [spring-aop-5.3.16.jar:5.3.16]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_331]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_331]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_331]
at java.lang.Thread.run(Thread.java:750) ~[na:1.8.0_331]
Caused by: org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:139) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:106) ~[spring-integration-core-5.5.9.jar:5.5.9]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:72) ~[spring-integration-core-5.5.9.jar:5.5.9]
... 64 common frames omitted
--------------------------- Edit 4 Job laucnhing code---------------
#Bean
#Scheduled( fixedRate = 150000L)
public void jobScheduled(){
logger.info("Job triggered");
getAllFileNames().stream().forEach( fileName-> {
jobRunner.runFlatFileBatchJob(fileName);
});
}
Thanks
Santrupta
It is not a problem of this outGateway bean and its gatewayinputchannel subscription. It is a problem of producer which sends to this gatewayinputchannel too early. So, share with us, please, what and how does that instead.

Flink kafka consumer couldn't deserialize avro data from kafka

i'm new in using apache Flink ,
I tried to consume avro data in Flink using the ConfluentAvroDeserializer ,
but the when i run the program , and produce some data to kafka using kafka-avro-console-producer
the program shows errors
here's the consumer i wrote using Scala in Flink
object Test {
def main(args: Array[String]): Unit = {
val env = StreamExecutionEnvironment.createLocalEnvironment();
val properties = new Properties();
properties.setProperty("bootstrap.servers", "localhost:9092");
properties.setProperty("group.id", "test");
val STRING_SCHEMA = "{\"type\":"record\",\"name\":"c1\",\"namespace\":"com.test\",\"fields\":[{\"name\":"f1\",\"type\":"string\"}]}" // the schema used to deserialize the data
val s = new Schema.Parser().parse(STRING_SCHEMA)
val schemaRegistryUrl = "http://localhost:8081"; // the schema registry url
val stream = env.addSource(new FlinkKafkaConsumer[GenericRecord]("second_topic",ConfluentRegistryAvroDeserializationSchema.forGeneric(s,schemaRegistryUrl), properties));
stream.print();
env.execute();
}
}
and these are the errors i got :
Exception in thread "main" org.apache.flink.runtime.client.JobExecutionException: Job execution failed.
at org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:144)
at org.apache.flink.runtime.minicluster.MiniClusterJobClient.lambda$getJobExecutionResult$3(MiniClusterJobClient.java:137)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)
at org.apache.flink.runtime.rpc.akka.AkkaInvocationHandler.lambda$invokeRpc$0(AkkaInvocationHandler.java:237)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)
at org.apache.flink.runtime.concurrent.FutureUtils$1.onComplete(FutureUtils.java:1081)
at akka.dispatch.OnComplete.internal(Future.scala:264)
at akka.dispatch.OnComplete.internal(Future.scala:261)
at akka.dispatch.japi$CallbackBridge.apply(Future.scala:191)
at akka.dispatch.japi$CallbackBridge.apply(Future.scala:188)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36)
at org.apache.flink.runtime.concurrent.Executors$DirectExecutionContext.execute(Executors.java:73)
at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:44)
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:252)
at akka.pattern.PromiseActorRef.$bang(AskSupport.scala:572)
at akka.pattern.PipeToSupport$PipeableFuture$$anonfun$pipeTo$1.applyOrElse(PipeToSupport.scala:22)
at akka.pattern.PipeToSupport$PipeableFuture$$anonfun$pipeTo$1.applyOrElse(PipeToSupport.scala:21)
at scala.concurrent.Future$$anonfun$andThen$1.apply(Future.scala:436)
at scala.concurrent.Future$$anonfun$andThen$1.apply(Future.scala:435)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:91)
at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
at akka.dispatch.BatchingExecutor$BlockableBatch$$anonfun$run$1.apply(BatchingExecutor.scala:91)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:90)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.apache.flink.runtime.JobException: Recovery is suppressed by NoRestartBackoffTimeStrategy
at org.apache.flink.runtime.executiongraph.failover.flip1.ExecutionFailureHandler.handleFailure(ExecutionFailureHandler.java:138)
at org.apache.flink.runtime.executiongraph.failover.flip1.ExecutionFailureHandler.getFailureHandlingResult(ExecutionFailureHandler.java:82)
at org.apache.flink.runtime.scheduler.DefaultScheduler.handleTaskFailure(DefaultScheduler.java:207)
at org.apache.flink.runtime.scheduler.DefaultScheduler.maybeHandleTaskFailure(DefaultScheduler.java:197)
at org.apache.flink.runtime.scheduler.DefaultScheduler.updateTaskExecutionStateInternal(DefaultScheduler.java:188)
at org.apache.flink.runtime.scheduler.SchedulerBase.updateTaskExecutionState(SchedulerBase.java:677)
at org.apache.flink.runtime.scheduler.SchedulerNG.updateTaskExecutionState(SchedulerNG.java:79)
at org.apache.flink.runtime.jobmaster.JobMaster.updateTaskExecutionState(JobMaster.java:435)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleRpcInvocation(AkkaRpcActor.java:305)
at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleRpcMessage(AkkaRpcActor.java:212)
at org.apache.flink.runtime.rpc.akka.FencedAkkaRpcActor.handleRpcMessage(FencedAkkaRpcActor.java:77)
at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleMessage(AkkaRpcActor.java:158)
at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:26)
at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:21)
at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:123)
at akka.japi.pf.UnitCaseStatement.applyOrElse(CaseStatements.scala:21)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)
at akka.actor.Actor$class.aroundReceive(Actor.scala:517)
at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:225)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:592)
at akka.actor.ActorCell.invoke(ActorCell.scala:561)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:258)
at akka.dispatch.Mailbox.run(Mailbox.scala:225)
at akka.dispatch.Mailbox.exec(Mailbox.scala:235)
... 4 more
Caused by: com.esotericsoftware.kryo.KryoException: java.lang.UnsupportedOperationException
Serialization trace:
reserved (org.apache.avro.Schema$Field)
fieldMap (org.apache.avro.Schema$RecordSchema)
schema (org.apache.avro.generic.GenericData$Record)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:528)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:761)
at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:143)
at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:21)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:679)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:106)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:528)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:679)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:106)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:528)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:657)
at org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializer.copy(KryoSerializer.java:273)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:69)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:46)
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.collect(CopyingChainingOutput.java:26)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:50)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:28)
at org.apache.flink.streaming.api.operators.StreamSourceContexts$ManualWatermarkContext.processAndCollectWithTimestamp(StreamSourceContexts.java:322)
at org.apache.flink.streaming.api.operators.StreamSourceContexts$WatermarkContext.collectWithTimestamp(StreamSourceContexts.java:426)
at org.apache.flink.streaming.connectors.kafka.internals.AbstractFetcher.emitRecordsWithTimestamps(AbstractFetcher.java:365)
at org.apache.flink.streaming.connectors.kafka.internals.KafkaFetcher.partitionConsumerRecordsHandler(KafkaFetcher.java:183)
at org.apache.flink.streaming.connectors.kafka.internals.KafkaFetcher.runFetchLoop(KafkaFetcher.java:142)
at org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumerBase.run(FlinkKafkaConsumerBase.java:826)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:110)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:66)
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:269)
Caused by: java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.add(Collections.java:1057)
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:109)
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:22)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:679)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:106)
Can you tell me what's the problem please ,
Thank you in advance

Cannot create JDBC driver of class 'com.ibm.db2.jcc.DB2Driver' for connect URL 'null'

I have used odbc6 driver to connect to the DB2 database. When i try to run job using spring batch i am getting the below error message can some one help me to fix the issue. I am not using any server here, i have included the required jars in the classpath and run the batch using run configuration in Eclipse. Also i am using
hibernate.cfg file to configure the context.
ERROR StatusLogger File not found in file system or classpath:
log4j2.xml ERROR StatusLogger No log4j2 configuration file found.
Using default configuration: logging only errors to the console.
15:06:27.268 [SimpleAsyncTaskExecutor-1] ERROR
com.usaa.fts.batch.pepplus.listeners.WriterListenerLogger - Error
writing object
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not
get JDBC Connection; nested exception is
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of class 'com.ibm.db2.jcc.DB2Driver' for connect URL 'null' at
org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
~[spring-jdbc-4.0.3.RELEASE.jar:4.0.3.RELEASE] at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:630)
~[inf-spring-batch-fixes.jar:4.0.3.RELEASE] at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:681)
~[inf-spring-batch-fixes.jar:4.0.3.RELEASE] at
org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:997)
~[inf-spring-batch-fixes.jar:4.0.3.RELEASE] at
org.springframework.jdbc.core.namedparam.NamedParameterBatchUpdateUtils.executeBatchUpdateWithNamedParameters(NamedParameterBatchUpdateUtils.java:40)
~[spring-jdbc-4.0.3.RELEASE.jar:4.0.3.RELEASE] at
org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.batchUpdate(NamedParameterJdbcTemplate.java:361)
~[spring-jdbc-4.0.3.RELEASE.jar:4.0.3.RELEASE] at
org.springframework.batch.item.database.JdbcBatchItemWriter.write(JdbcBatchItemWriter.java:181)
~[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
com.usaa.inf.batch2.writers.UsaaJdbcBatchItemWriter.writeItems(UsaaJdbcBatchItemWriter.java:85)
~[inf-batch-impl-2.0.jar:?] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[?:1.8.0_144] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[?:1.8.0_144] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498)
~[?:1.8.0_144] at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
~[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
~[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
~[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
~[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
~[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
~[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
~[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
com.sun.proxy.$Proxy25.writeItems(Unknown Source) ~[?:?] at
org.springframework.batch.jsr.item.ItemWriterAdapter.write(ItemWriterAdapter.java:55)
~[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.step.item.JsrChunkProcessor.doPersist(JsrChunkProcessor.java:243)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.step.item.JsrFaultTolerantChunkProcessor$5.doWithRetry(JsrFaultTolerantChunkProcessor.java:298)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263)
[spring-retry-1.1.0.RELEASE.jar:?] at
org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:168)
[spring-retry-1.1.0.RELEASE.jar:?] at
org.springframework.batch.core.step.item.BatchRetryTemplate.execute(BatchRetryTemplate.java:222)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.step.item.JsrFaultTolerantChunkProcessor.persist(JsrFaultTolerantChunkProcessor.java:348)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.step.item.JsrChunkProcessor.process(JsrChunkProcessor.java:114)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368)
[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:198)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState.handle(JsrStepState.java:53)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:165)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.job.flow.JsrFlowJob.doExecute(JsrFlowJob.java:82)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:304)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.launch.JsrJobOperator$2.run(JsrJobOperator.java:675)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
java.lang.Thread.run(Thread.java:748) [?:1.8.0_144] Caused by:
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of class 'com.ibm.db2.jcc.DB2Driver' for connect URL 'null' at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1169)
~[com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar:?] at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:882)
~[com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar:?] at
org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
~[spring-jdbc-4.0.3.RELEASE.jar:4.0.3.RELEASE] at
org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
~[spring-jdbc-4.0.3.RELEASE.jar:4.0.3.RELEASE] ... 48 more Caused by:
java.lang.NullPointerException at
oracle.jdbc.driver.OracleDriver.acceptsURL(OracleDriver.java:638)
~[ojdbc6-11.2.0.3.jar:11.2.0.3.0] at
java.sql.DriverManager.getDriver(DriverManager.java:299)
~[?:1.8.0_144] at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1160)
~[com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar:?] at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:882)
~[com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar:?] at
org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
~[spring-jdbc-4.0.3.RELEASE.jar:4.0.3.RELEASE] at
org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
~[spring-jdbc-4.0.3.RELEASE.jar:4.0.3.RELEASE] ... 48 more
15:06:28.799 [SimpleAsyncTaskExecutor-1] ERROR
com.usaa.fts.batch.pepplus.listeners.WriterListenerLogger - Could not
cast exception java.lang.ClassCastException:
org.springframework.jdbc.CannotGetJdbcConnectionException cannot be
cast to java.sql.BatchUpdateException at
com.usaa.fts.batch.pepplus.listeners.WriterListenerLogger.onWriteError(WriterListenerLogger.java:37)
[bin/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) ~[?:1.8.0_144] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[?:1.8.0_144] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[?:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498)
~[?:1.8.0_144] at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
[spring-aop-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
com.sun.proxy.$Proxy28.onWriteError(Unknown Source) [?:?] at
org.springframework.batch.core.jsr.ItemWriteListenerAdapter.onWriteError(ItemWriteListenerAdapter.java:68)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.listener.CompositeItemWriteListener.onWriteError(CompositeItemWriteListener.java:86)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.listener.MulticasterBatchListener.onWriteError(MulticasterBatchListener.java:303)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.step.item.JsrChunkProcessor.doPersist(JsrChunkProcessor.java:247)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.step.item.JsrFaultTolerantChunkProcessor$5.doWithRetry(JsrFaultTolerantChunkProcessor.java:298)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263)
[spring-retry-1.1.0.RELEASE.jar:?] at
org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:168)
[spring-retry-1.1.0.RELEASE.jar:?] at
org.springframework.batch.core.step.item.BatchRetryTemplate.execute(BatchRetryTemplate.java:222)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.step.item.JsrFaultTolerantChunkProcessor.persist(JsrFaultTolerantChunkProcessor.java:348)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.step.item.JsrChunkProcessor.process(JsrChunkProcessor.java:114)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
[spring-tx-4.0.5.RELEASE.jar:4.0.5.RELEASE] at
org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368)
[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
[spring-batch-infrastructure-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:198)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState.handle(JsrStepState.java:53)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:165)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.job.flow.JsrFlowJob.doExecute(JsrFlowJob.java:82)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:304)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
org.springframework.batch.core.jsr.launch.JsrJobOperator$2.run(JsrJobOperator.java:675)
[spring-batch-core-3.0.4.RELEASE.jar:3.0.4.RELEASE] at
java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
You cannot use ojdbc6 to connect to a Db2 database. ojdbc6 is for connecting to databases that use the Oracle RDBMS.
To connect to a Db2-database, you need an installed Db2-driver, and if the Db2-server runs on Z/OS or i-Series then you also need a relevant license (unless your company has a Db2-connect gateway).
For Db2-for-Linux/Unix/Windows (or Db2-connect gateways) , Get a suitable Db2-driver here. For i-Series, contact your i-Series administrator.
Adding these jars worked for me
db2jcc_license_cisuz.jar
db2jcc4.jar

Citrus integration tests fail randomly

Following up on How to access variables in a (citrus) static-response-adapter
Test layout:
Citrus -> SUT
SUT <-> MockServerOne
SUT <-> MockServerTwo
Citrus <- SUT
Applying the suggestions from the post above, I now see randomly occuring exceptions.
The test code:
#Test
#CitrusTest
public void testRequestNok() throws Exception {
setDefaultTestVariables();
http(builder -> builder
.client("fooClient")
.send()
.post("/foo/bar")
.payload(new ClassPathResource("foo/foo-sample-request.xml"))
.messageType(MessageType.XML)
.contentType("application/xml")
.accept("application/xml")
.fork(true));
applyBehavior(new MockOneServerBehavior());
applyBehavior(new MockTwoServerBehavior("bar/bar-error-response.xml"));
http(builder -> builder.client("fooClient").receive().response(HttpStatus.BAD_GATEWAY));
}
where the behaviors look like this
public class MockOneServerBehavior extends AbstractTestBehavior {
public void apply() {
http(builder -> builder.server("mockServerOne")
.receive()
.post());
http(builder -> builder.server("mockServerOne")
.send()
.response()
.payload(new ClasspathResource("foo/bar.xml"));
}
}
The test fails (roughly in 5% of all cases) and so far I have seen two different kinds of exceptions:
A ConcurrentModificationException:
2017-03-02 11:00:54,836 main [DEBUG ] citrus.channel.ChannelConsumer - Receiving message from: mockServerOne.inbound
2017-03-02 11:00:54,831 qtp1185618138-20 [DEBUG ] http.servlet.CitrusDispatcherServlet - Could not complete request
org.springframework.messaging.MessageDeliveryException: failed to send Message to channel 'mockServerOne.inbound'; nested exception is java.util.ConcurrentModificationException
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:449) ~[spring-integration-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373) ~[spring-integration-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115) ~[spring-messaging-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:150) ~[spring-messaging-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:45) ~[spring-messaging-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:42) ~[spring-messaging-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.integration.core.MessagingTemplate.sendAndReceive(MessagingTemplate.java:97) ~[spring-integration-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at com.consol.citrus.channel.ChannelSyncProducer.send(ChannelSyncProducer.java:76) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.channel.ChannelEndpointAdapter.handleMessageInternal(ChannelEndpointAdapter.java:68) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.endpoint.AbstractEndpointAdapter.handleMessage(AbstractEndpointAdapter.java:55) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.http.controller.HttpMessageController.handleRequestInternal(HttpMessageController.java:137) ~[citrus-http-2.7.jar:?]
at com.consol.citrus.http.controller.HttpMessageController.handlePostRequest(HttpMessageController.java:63) ~[citrus-http-2.7.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [javax.servlet-api-3.1.0.jar:3.1.0]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841) [jetty-servlet-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634) [jetty-servlet-9.4.1.v20170120.jar:9.4.1.v20170120]
at com.consol.citrus.http.servlet.GzipServletFilter.doFilterInternal(GzipServletFilter.java:43) [citrus-http-2.7.jar:?]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621) [jetty-servlet-9.4.1.v20170120.jar:9.4.1.v20170120]
at com.consol.citrus.http.servlet.RequestCachingServletFilter.doFilterInternal(RequestCachingServletFilter.java:41) [citrus-http-2.7.jar:?]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621) [jetty-servlet-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541) [jetty-servlet-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1228) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481) [jetty-servlet-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1130) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:118) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.Server.handle(Server.java:564) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [jetty-server-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) [jetty-io-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:112) [jetty-io-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) [jetty-io-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672) [jetty-util-9.4.1.v20170120.jar:9.4.1.v20170120]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590) [jetty-util-9.4.1.v20170120.jar:9.4.1.v20170120]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112]
Caused by: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1437) ~[?:1.8.0_112]
at java.util.HashMap$EntryIterator.next(HashMap.java:1471) ~[?:1.8.0_112]
at java.util.HashMap$EntryIterator.next(HashMap.java:1469) ~[?:1.8.0_112]
at java.util.AbstractMap.toString(AbstractMap.java:554) ~[?:1.8.0_112]
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2886) ~[?:1.8.0_112]
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2763) ~[?:1.8.0_112]
at java.util.Formatter.format(Formatter.java:2520) ~[?:1.8.0_112]
at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_112]
at java.lang.String.format(String.java:2940) ~[?:1.8.0_112]
at com.consol.citrus.message.DefaultMessage.toString(DefaultMessage.java:108) ~[citrus-core-2.7.jar:?]
at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_112]
at java.lang.StringBuilder.append(StringBuilder.java:131) ~[?:1.8.0_112]
at org.springframework.messaging.support.GenericMessage.toString(GenericMessage.java:111) ~[spring-messaging-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_112]
at java.lang.StringBuilder.append(StringBuilder.java:131) ~[?:1.8.0_112]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:430) ~[spring-integration-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
... 56 more
and a problem with TypeConversion, which leads to a XMLParseException:
2017-03-02 11:11:59,543 main [DEBUG ] citrus.validation.MessageValidatorRegistry - Found 3 message validators for message type: XML
2017-03-02 11:11:59,543 main [DEBUG ] validation.xml.DomXmlMessageValidator - Start message validation ...
2017-03-02 11:11:59,543 main [DEBUG ] validation.xml.DomXmlMessageValidator - Start XML message validation
2017-03-02 11:11:59,544 main [WARN ] citrus.util.TypeConversionUtils - Using object toString representation: Failed to convert value of type 'java.io.ByteArrayInputStream' to required type 'java.lang.String'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.io.ByteArrayInputStream' to required type 'java.lang.String': no matching editors or conversion strategy found
2017-03-02 11:11:59,544 main [WARN ] citrus.util.TypeConversionUtils - Using object toString representation: Failed to convert value of type 'java.io.ByteArrayInputStream' to required type 'java.lang.String'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.io.ByteArrayInputStream' to required type 'java.lang.String': no matching editors or conversion strategy found
[Fatal Error] :1:1: Content is not allowed in prolog.
2017-03-02 11:11:59,553 main [INFO ] consol.citrus.Citrus -
2017-03-02 11:11:59,553 main [ERROR ] consol.citrus.Citrus - TEST FAILED FooTest.testBar <foo.bar.baz> Nested exception is:
com.consol.citrus.exceptions.CitrusRuntimeException: org.w3c.dom.ls.LSException: Content is not allowed in prolog.
at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateMessagePayload(DomXmlMessageValidator.java:116) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateMessagePayload(DomXmlMessageValidator.java:68) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:65) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.validation.AbstractMessageValidator.validateMessage(AbstractMessageValidator.java:50) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.actions.ReceiveMessageAction.validateMessage(ReceiveMessageAction.java:216) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.actions.ReceiveMessageAction.doExecute(ReceiveMessageAction.java:133) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.dsl.actions.DelegatingTestAction.doExecute(DelegatingTestAction.java:54) ~[citrus-java-dsl-2.7.jar:?]
at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.TestCase.executeAction(TestCase.java:229) [citrus-core-2.7.jar:?]
at com.consol.citrus.dsl.runner.DefaultTestRunner.run(DefaultTestRunner.java:198) ~[citrus-java-dsl-2.7.jar:?]
at com.consol.citrus.dsl.runner.DefaultTestRunner.http(DefaultTestRunner.java:526) [citrus-java-dsl-2.7.jar:?]
at com.consol.citrus.dsl.testng.TestNGCitrusTestRunner.http(TestNGCitrusTestRunner.java:360) ~[citrus-java-dsl-2.7.jar:?]
at foo.bar.baz.FooTest.testFoo(FooTest.java:92) ~[integrationTest/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216) ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at com.consol.citrus.dsl.testng.TestNGCitrusTest.invokeTestMethod(TestNGCitrusTest.java:139) ~[citrus-java-dsl-2.7.jar:?]
at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:109) [citrus-java-dsl-2.7.jar:?]
at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:58) [citrus-java-dsl-2.7.jar:?]
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:209) [testng-6.9.10.jar:?]
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639) [testng-6.9.10.jar:?]
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) [testng-6.9.10.jar:?]
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) [testng-6.9.10.jar:?]
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) [testng-6.9.10.jar:?]
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) [testng-6.9.10.jar:?]
at org.testng.TestRunner.privateRun(TestRunner.java:782) [testng-6.9.10.jar:?]
at org.testng.TestRunner.run(TestRunner.java:632) [testng-6.9.10.jar:?]
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) [testng-6.9.10.jar:?]
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) [testng-6.9.10.jar:?]
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) [testng-6.9.10.jar:?]
at org.testng.SuiteRunner.run(SuiteRunner.java:268) [testng-6.9.10.jar:?]
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) [testng-6.9.10.jar:?]
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) [testng-6.9.10.jar:?]
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244) [testng-6.9.10.jar:?]
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169) [testng-6.9.10.jar:?]
at org.testng.TestNG.run(TestNG.java:1064) [testng-6.9.10.jar:?]
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72) [testng-plugin.jar:?]
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127) [testng-plugin.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:?]
Caused by: org.w3c.dom.ls.LSException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParserImpl.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at com.consol.citrus.util.XMLUtils.parseMessagePayload(XMLUtils.java:356) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateXMLSchema(DomXmlMessageValidator.java:148) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateMessagePayload(DomXmlMessageValidator.java:91) ~[citrus-core-2.7.jar:?]
... 45 more
Caused by: org.apache.xerces.xni.parser.XMLParseException: Content is not allowed in prolog.
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at org.apache.xerces.parsers.DOMParserImpl.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:?]
at com.consol.citrus.util.XMLUtils.parseMessagePayload(XMLUtils.java:356) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateXMLSchema(DomXmlMessageValidator.java:148) ~[citrus-core-2.7.jar:?]
at com.consol.citrus.validation.xml.DomXmlMessageValidator.validateMessagePayload(DomXmlMessageValidator.java:91) ~[citrus-core-2.7.jar:?]
... 45 more
In case of the XMLParseException, I have verified on HTTP level that the response is identical to when the test actually passes.
Both exceptions look like threading issues to me.
I would be grateful for any feedback or alternative approach I might try.
Indeed this has been an issue located in the default message implementation when converting its payload to a String for logging purpose. The issue has been fixed with the mentioned github commit:
https://github.com/christophd/citrus/commit/2c0e70c4db9af102c2544ad60fb9447afb8a7b9c
Mentioned behavior is fixed since Citrus 2.7.2.

JAX-WS Apache CXF Connection Error

The Apache CXF and the JAX-WS always seems to cause issues. I'm not sure if I'm using it wrongly!
Here is the exception that I get:
20151203-15:14:06.836+0100 [play-akka.actor.default-dispatcher-9] ERROR my.proj - Asset E911S (SOAP) -- unknown error occurred at 2015-12-03T14:14:05.778Z while reading tag getSlave
javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:150) ~[cxf-rt-frontend-jaxws-3.1.4.jar:3.1.4]
at com.sun.proxy.$Proxy57.getSlave(Unknown Source) ~[na:na]
at my.proj.connectors.soap.MyServiceClient$$anonfun$getSlave$1.apply(MyServiceClient.scala:174) ~[classes/:na]
at my.proj.connectors.soap.MyServiceClient$$anonfun$getSlave$1.apply(MyServiceClient.scala:97) ~[classes/:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library-2.11.7.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library-2.11.7.jar:na]
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41) [akka-actor_2.11-2.3.4.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393) [akka-actor_2.11-2.3.4.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.7.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.11.7.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.7.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.7.jar:na]
Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://1/c.2.3.4/gi-bin/cgi.cgi?WebService: Read timed out
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_60]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_60]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1376) ~[cxf-rt-transports-http-3.1.4.jar:3.1.4]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1360) ~[cxf-rt-transports-http-3.1.4.jar:3.1.4]
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[cxf-core-3.1.4.jar:3.1.4]
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651) ~[cxf-rt-transports-http-3.1.4.jar:3.1.4]
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ~[cxf-core-3.1.4.jar:3.1.4]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[cxf-core-3.1.4.jar:3.1.4]
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514) ~[cxf-core-3.1.4.jar:3.1.4]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) ~[cxf-core-3.1.4.jar:3.1.4]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324) ~[cxf-core-3.1.4.jar:3.1.4]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277) ~[cxf-core-3.1.4.jar:3.1.4]
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) ~[cxf-rt-frontend-simple-3.1.4.jar:3.1.4]
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139) ~[cxf-rt-frontend-jaxws-3.1.4.jar:3.1.4]
... 11 common frames omitted
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_60]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_60]
at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[na:1.8.0_60]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_60]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_60]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[na:1.8.0_60]
Here is what I do to set the context!
private def setRequestContext(proxy: Client, withCredentials: Boolean = false): Unit = {
// set the time out!
val httpConduit = proxy.getConduit.asInstanceOf[HTTPConduit]
val httpClientPolicy = new HTTPClientPolicy()
httpClientPolicy.setConnectionTimeout(mySoapClientConfig.requestTimeout.toSeconds)
httpClientPolicy.setReceiveTimeout(mySoapClientConfig.requestTimeout.toSeconds)
httpConduit.setClient(httpClientPolicy)
if (withCredentials) {
val userCredentials = new UserCredentials
userCredentials.setPassword(mySoapClientConfig.password.orNull)
userCredentials.setUserName(mySoapClientConfig.userName.orNull)
val headerList = Seq(
new Header(
new QName(mySoapClientConfig.targetNamespace, "UserCredentials"),
userCredentials,
new JAXBDataBinding(classOf[UserCredentials])
)
)
import scala.collection.JavaConverters._
proxy.getRequestContext.put(Header.HEADER_LIST, headerList.asJava)
}
}
Could anyone please help me out? I'm able to connect to the WebService using SOAP UI!
I figured out what the problem was. Pay close attention to the following line:
httpClientPolicy.setConnectionTimeout(mySoapClientConfig.requestTimeout.toSeconds)
httpClientPolicy.setReceiveTimeout(mySoapClientConfig.requestTimeout.toSeconds)
The setXXXTimeout takes a long in millis and what I have been passing in was 4 seconds which was understood as 4 millis, which was causing the read time outs!