0

I'm trying to play around Spring WebFlux Webclient. Tried to create a simple webclient in a quartz cron job

this.webClient = WebClient.create(this.queryUrl);

I made sure the queryUrl is valid.

However, I've got an error as following:

java.lang.ExceptionInInitializerError: null
at org.springframework.web.reactive.function.client.ExchangeStrategies.withDefaults(ExchangeStrategies.java:67)
at org.springframework.web.reactive.function.client.DefaultWebClientBuilder.initExchangeStrategies(DefaultWebClientBuilder.java:302)
at org.springframework.web.reactive.function.client.DefaultWebClientBuilder.build(DefaultWebClientBuilder.java:269)
at org.springframework.web.reactive.function.client.WebClient.create(WebClient.java:154)

Tracing into the code, I've found that DefaultExchangeStrategiesBuilder is null.

Does anyone have any idea what is missing? It's a simple web client.

Thanks.

Jin Ma
  • 169
  • 2
  • 12
  • Is it related to the webclient is initialized in quartz job scheduler's at ..............CollectorJob.execute(CollectorJob.java:35) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) – Jin Ma Oct 07 '21 at 16:03

1 Answers1

0
<dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.13.0</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.13.0</version>
    </dependency>

Adding these dependencies and making sure the versions are the same. I only had jackson-core before.

I tried to move the job out of quartz and ran it directly in main. it still threw an exception, but it's different and I then looked it up and some one has asked the issue and the solution to make sure both jackson packages need to be included and versions must be same.

I then added them to the pom file. try to run the job and it worked. Putting the job back to quartz to run and it also worked.

Jin Ma
  • 169
  • 2
  • 12