Skip to content
Advertisement

Error creating bean with name ‘solverManager’, Unsatisfied dependency expressed through constructor parameter

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures using Spring-boot framework. Jhipster has “straight to go” script to deploy on google cloud.

Optaplanner is an AI library which helps solve planning and scheduling problems.

My goal is to use Jhipster to develop quickly a platform which resort to optaplanner to solve a specific problem, and finally deploy the code on Google Kubernate. I finally come with a solution by merging examples codes from Optaplanner and Jhipster.

As shown in the folowing output, it works well on my machine on local.After installing Jhipster :

JavaScript

██╗ ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗ ██║ ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗ ██║ ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝ ██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ ╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝

JavaScript

But when I execute the script to deploy the same code on Google Kuberntes, I face the following error:

JavaScript

Output from Kubernetes logs:

JavaScript

This is the code for the SolverManager bean injection, based on the Jhipster examples code:

JavaScript

The full code can be found here. I don’t understand why this “Unsatisfied dependency” happens when deployed on gke whereas there is no such error on local machine, nor on gce.

Can someone help me solve this?

Advertisement

Answer

There is a NullPointerException lurking in the stack trace:

JavaScript

Having never seen this exception before, I can make an educated guess: could it be that you don’t have a Java compiler on the machine? Please install a full JDK (one that brings javac as well as java) and this problem may go away.

The reason for that is that Constraint Streams – in order to generate the code for your constraints – will need to compile some Java classes into bytecode. And without javac, that is not possible.

Advertisement