[ 
https://issues.apache.org/jira/browse/CAMEL-22021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17949909#comment-17949909
 ] 

Vincent Paturet commented on CAMEL-22021:
-----------------------------------------

In our CI environment we download the Google PubSub emulator from a private 
Maven repository.
If you want to run the tests locally, you need some additional configuration:
1) install the Google Cloud SDK with the PubSub emulator
2) switch this property to true: 
https://github.com/entur/marduk/blob/40bddd88ed650ef132b810ebbd4e41fbc55184e5/pom.xml#L28
3) update this property to point to the pubsub emulator jar file that is 
shipped with the Google Cloud SDK: 
https://github.com/entur/marduk/blob/40bddd88ed650ef132b810ebbd4e41fbc55184e5/src/test/resources/application.properties#L51

(I have updated the PR to make it easier to configure)

If this is not practical for you, I can switch the test configuration to 
TestContainers (but then the tests will not run in parallel anymore and the bug 
might be more difficult to reproduce)

> camel-test - NPE on DefaultMessage.typeConverter in CSB with AdviceWith 
> happens randomly
> ----------------------------------------------------------------------------------------
>
>                 Key: CAMEL-22021
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22021
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring-boot, camel-test
>    Affects Versions: 4.8.6, 4.10.3, 4.11.0
>            Reporter: Vincent Paturet
>            Priority: Minor
>             Fix For: 4.12.0
>
>
> When upgrading from Camel 4.4.5 to Camel 4.8.6 or 4.10.3 or 4.11.0, some unit 
> tests fail randomly with the following error:
> {code:java}
> java.lang.NullPointerException: Cannot invoke 
> "org.apache.camel.TypeConverter.convertTo(java.lang.Class, 
> org.apache.camel.Exchange, Object)" because "this.typeConverter" is null
>      at 
> org.apache.camel.support.DefaultMessage.getHeader(DefaultMessage.java:173)
>      at 
> org.apache.camel.processor.aggregate.AggregateProcessor.isCompleteAllGroups(AggregateProcessor.java:447)
>      at 
> org.apache.camel.processor.aggregate.AggregateProcessor.doProcess(AggregateProcessor.java:333)
>      at 
> org.apache.camel.processor.aggregate.AggregateProcessor.process(AggregateProcessor.java:319)
>      at 
> org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.handleFirst(RedeliveryErrorHandler.java:440)
>      at 
> org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:416)
>      at 
> org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199)
>      at 
> org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.executeReactiveWork(DefaultReactiveExecutor.java:189)
>      at 
> org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.tryExecuteReactiveWork(DefaultReactiveExecutor.java:166)
>      at 
> org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
>      at 
> org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
>      at org.apache.camel.processor.Pipeline.process(Pipeline.java:163)
>      at 
> org.apache.camel.impl.engine.CamelInternalProcessor.processNonTransacted(CamelInternalProcessor.java:347)
>      at 
> org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:323)
>      at 
> org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:82)
>      at 
> org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:32)
>      at 
> org.apache.camel.component.google.pubsub.consumer.CamelMessageReceiver.receiveMessage(CamelMessageReceiver.java:70)
>      at 
> com.google.cloud.pubsub.v1.MessageDispatcher$3.run(MessageDispatcher.java:552)
>      at 
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
>      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
>      at 
> java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
>      at 
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
>      at 
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
>      at java.base/java.lang.Thread.run(Thread.java:1583){code}
> - The failure is random (once every 3-4 runs)
> - The unit tests use @CamelSpringBootTest and @UseAdviceWith and start the 
> context manually: context.start()
> - The tests that fail seem to always use message aggregation 
> (org.apache.camel.processor.aggregate.AggregateProcessor)
> The error being triggered randomly I cannot come up with a simple reproducer 
> test case.
> I can share code and more details if needed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to