Develop and Deploy Microservices with JHipster

Develop and Deploy Microservices with JHipster

This tutorial shows you how to build microservices with JHipster. You’ll generate a gateway (powered by Netflix Zuul and the JHipster Gateway), a microservice (that talks to MongoDB), and use Docker Compose to run it all. Then you’ll deploy it to Google Cloud using Kubernetes.


Great article!
I have a question, is it possible to manage entities on the microservice app (not the gateway) using JDL? and then do the same in the gateway with jdl. How will the gateway know that the backend component is in another project like in the case of the store and only do the UI part? Because when you run the generation with jdl in the blog app (gateway) even the backend code was generated. Is there like a parameter for jdl or something to avoid server or client code generation and just point to other projects for the already existing code?

Matt Raible

Thanks, I’m glad you liked it! If you run yo jhipster:import-jdl on your microservice app, it will only generate the server-side code. Then you can run yo jhipster:entity $name on your gateway app and it’ll prompt you for the location of your microservice app and import the existing entities.

Andre Kapp

Good morning Matt

Have you made any progress with the deployment to AWS?
I saw this discussion, but it seems to have died……

I’m running my JHipster microservices on GoogleCloud as well. Use the Google Pub/Sub for inter-service comms. It also allows me to run a SpringBoot app in the clients office where they run a local install of Pastel. I can then trigger invoice generation, etc from the Cloud env.
The only problem is that it is super sensitive with mvn versions. Upgraded the app and now all messaging stops again. Was trying AWS, but also ran into some of the problems you have mentioned.


Matt Raible

Hello Andre: I have not made any progress on deploying JHipster to AWS. I hope to revisit it soon. In the meantime, I’d recommend checking out Chris Anatalio’s LinkedIn Learning course on JHipster. It says it covers AWS. Please report back if you’re successful!

Mark Schreiber

While working my way through this tutorial I got stuck at the… step. When I attempt ./mvnw -Pprod package I get an error which seems to be a problem with one of the node modules.

Node version = v8.9.4
Yarn version = 1.3.2
Yo version = 2.0.1
JHipster version = 4.14.0

[INFO] $ node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack/ --profile
[INFO] MergetJsonsWebpackPlugin compilation started…
[INFO] MergetJsonsWebpackPlugin compilation completed…
[ERROR] buffer.js:202
[ERROR] throw new TypeError(kFromErrorMsg);
[ERROR] TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
[ERROR] at Function.Buffer.from (buffer.js:202:9)
[ERROR] at new Buffer (buffer.js:158:17)
[ERROR] at writeOut (/Users/mschreiber/develop/jhipster-microservices-example/blog/node_modules/webpack/lib/Compiler.js:334:17)
[ERROR] at require.forEach (/Users/mschreiber/develop/jhipster-microservices-example/blog/node_modules/webpack/lib/Compiler.js:345:12)
[ERROR] at /Users/mschreiber/develop/jhipster-microservices-example/blog/node_modules/webpack/node_modules/async/dist/async.js:3096:16
[ERROR] at eachOfArrayLike (/Users/mschreiber/develop/jhipster-microservices-example/blog/node_modules/webpack/node_modules/async/dist/async.js:1055:9)
[ERROR] at eachOf (/Users/mschreiber/develop/jhipster-microservices-example/blog/node_modules/webpack/node_modules/async/dist/async.js:1103:5)
[ERROR] at Object.eachLimit (/Users/mschreiber/develop/jhipster-microservices-example/blog/node_modules/webpack/node_modules/async/dist/async.js:3158:5)
[ERROR] at emitFiles (/Users/mschreiber/develop/jhipster-microservices-example/blog/node_modules/webpack/lib/Compiler.js:315:21)
[ERROR] at /Users/mschreiber/develop/jhipster-microservices-example/blog/node_modules/mkdirp/index.js:30:20
[ERROR] at FSReqWrap.oncomplete (fs.js:135:15)
[ERROR] error Command failed with exit code 1.
[INFO] info Visit… for documentation about this command.
[ERROR] error Command failed with exit code 1.
[INFO] info Visit… for documentation about this command.
[ERROR] error Command failed with exit code 1.
[INFO] info Visit… for documentation about this command.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 58.200 s
[INFO] Finished at: 2018-03-05T14:58:21-05:00
[INFO] Final Memory: 42M/374M
[INFO] ------------------------------------------------------------------------

Mahender Singh

Getting error when connecting store microservice from blog UI :
Access Control: allowing access for /services/store/api/product, as no access control policy has been set up for service: store

Enter: with argument[s] = [AuditEvent [timestamp=2019-12-07T07:42:44.463866Z, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={ RemoteIpAddress:; SessionId: null,, message=Access is denied}]]
2019-12-07 13:12:44.464 DEBUG 64437 — [ XNIO-1 task-5] : Exit: with result = null
2019-12-07 13:12:44.474 WARN 64437 — [ XNIO-1 task-5] o.z.problem.spring.common.AdviceTraits : Unauthorized: Full authentication is required to access this resource
2019-12-07 13:12:44.507 WARN 64437 — [ XNIO-1 task-5] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [ Full authentication is required to access this resource]

Matt Raible

This tutorial was written for JHipster 4. If you’re using JHipster 4, it should work. If you’re using JHipster 6, you might want to check out Java Microservices with Spring Cloud Config and JHipster.

onlinetutor find

online database diagram

drasko kosovic

Hi Matt,
Great article! ,
I was able to deploy microservis app to Google Cloud following the instructions in your example. However, publishing on Google cloud expensive for me. Since it is expensive for me I think my only solution is deploy on Heroku. , I tried that according to the instructions from web site to publish a geteway with a postgres database, I created a jhipster register on heroka and successfully deploy a microservice on Heroku, but I can’t deploy geteway app, I just can’t log in, which probably means no base. If you have any idea where I could find an example like this but on Heroku it would mean a lot to me.
Thank you in advance

Deepu K Sasidharan

Does the gateway show up in the registry? You said you can’t login, so does it mean the gateway was deployed but you can’t login to it? Also we would need more information regarding the app itself.

Hi Deepu,
Thank you for paying attention to my question. As for the first question: “Does the gateway show up in the registry?” the answer is Yes or Status DOWN. When I typed, "
heroku logs --tail "
I received a notification: "org.postgresql.util.PSQLException: Connection to localhost: 5432 refused. Check that the hostname and port are correct
and that the postmaster is accepting TCP / IP connections. "
In a local environment (./ mvnw -Pprod) the gateway application works well.
If you have time you can check on my Heroku account:
password: Trepca1959 @.
My Jhipster registry application on Herok is:
My Gateway application on hero is: “”,
Also to note that with the microservis app deploy is ok Status U
Thank you in advance this means a lot to me.