Build Spring Microservices and Dockerize them for Production
Learn how to build and package a microservices architecture with Spring Boot and Spring Cloud in this tutorial.
Build Spring Microservices and Dockerize them for Production
Learn how to build and package a microservices architecture with Spring Boot and Spring Cloud in this tutorial.
Rémi BOURGAREL
Why do you use “openjdk:8-jdk-alpine” instead of “openjdk:8-jre-alpine” ? The later seems way smaller
kitplummer
ADD target/*.jar app.jar
fails because docker expects the target to be a directory - copying multiple files.
Matt Raible
I’ve seen error when you don’t run “clean” first. Can you run “mvn clean install” and see if that helps?
mxu
Matt, it appears the link above was somehow modified (or hijacked to be precise). Not sure how it broke into the Discus. Just FYI.
Matt Raible
Thanks for the heads up. It doesn’t look like I can edit my comment anymore (or delete it).
aaronpk
Testing, here’s the correct link: Spring Boot with Docker
aaronpk
Sorry for the spam, this should trigger the incorrect URL:
Kumar Abhishek Shahi
Hi Raphael,
First of all thank you so much for the article.
While implementing I am facing issues. After adding Spring Cloud Config and OAuth2.0 when i restart school-ui it fails with below errors,
[ restartedMain] o.s.boot.SpringApplication : Application run failedorg.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.util.LinkedHashMap] to type [java.lang.String]at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321)
Matt Raible
Hello Kumar,
Can you please compare your code with the example app on GitHub? It’s possible you’re using different versions than this tutorial uses.
Kumar Abhishek Shahi
Thank you Matt for your reply. I am using exampleApp code taken from github only but not able to figureout how to fix. Can you help?
Matt Raible
I tried the project tonight by cloning and building it:
git clone GitHub - oktadev/okta-spring-microservices-docker-example: Spring Microservices and Docker Example
cd okta-spring-microservices-docker-example
Then I ran Maven to install all the projects and build Docker images.
cd config && ./mvnw clean install
cd …/discovery && ./mvnw clean install
cd … && ./mvnw clean install
Then I ran docker-compose up
to start everything. You can see from the screenshot below that all services started up.
I’m running on Java 12.
openjdk 12.0.2 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
Jamela Ndhlovhu
https://uploads.disquscdn.c… HI Raphael, I seem to be having some issues with this article. After the section called “Change School UI to Use Spring Cloud Config and OAuth 2.0” and restart school-ui and configuration, I get this error message attached
Matt Raible
I’ve seen this happen in the past for a couple reasons, the biggest one being that your system clock doesn’t match an internet clock. Make sure those are in sync. The other thing to check is that you’re using the “default” authorization server and not your “org” authorization server. The default one has an issuer that ends with “/oauth2/default”. Finally, you might try comparing your code to the example on GitHub.
Jamela Ndhlovhu
Hi Matt, thank you for your assistance, it is much appreciated. My computer is definitely in sync with the internet clock and when i checked the okta.oauth2.issuer variable, i saw that it ended with “/oauth2/default”
Deminem
Hi @mattraible - I confirm that example is working by following the steps mentioned above. But in the logs, I can constantly see the “Read Time out” exceptions.
Is it a known behaviour? Or can we fix these Read Time out errors.
discovery_1 | 2020-04-04 16:53:38.029 ERROR 1 — [get_localhost-6] c.n.e.cluster.ReplicationTaskProcessor : It seems to be a socket read timeout exception, it will retry later. if it continues to happen and some eureka node occupied all the cpu time, you should set property ‘eureka.server.peer-node-read-timeout-ms’ to a bigger value
discovery_1 | com.sun.jersey.api.client.ClientHandlerException: java.net.SocketTimeoutException: Read timed out
discovery_1 | at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar!/:1.19.1]
discovery_1 | at com.netflix.eureka.cluster.DynamicGZIPContentEncodingFilter.handle(DynamicGZIPContentEncodingFilter.java:48) ~[eureka-core-1.9.8.jar!/:1.9.8]
discovery_1 | at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.9.8.jar!/:1.9.8]
discovery_1 | at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar!/:1.19.1]
discovery_1 | at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) ~[jersey-client-1.19.1.jar!/:1.19.1]
discovery_1 | at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) ~[jersey-client-1.19.1.jar!/:1.19.1]
discovery_1 | at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570) ~[jersey-client-1.19.1.jar!/:1.19.1]
discovery_1 | at com.netflix.eureka.transport.JerseyReplicationClient.submitBatchUpdates(JerseyReplicationClient.java:116) ~[eureka-core-1.9.8.jar!/:1.9.8]
discovery_1 | at com.netflix.eureka.cluster.ReplicationTaskProcessor.process(ReplicationTaskProcessor.java:80) ~[eureka-core-1.9.8.jar!/:1.9.8]
discovery_1 | at com.netflix.eureka.util.batcher.TaskExecutors$BatchWorkerRunnable.run(TaskExecutors.java:193) [eureka-core-1.9.8.jar!/:1.9.8]
discovery_1 | at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]
Matt Raible
Hmmm, does this same thing happen if you clone the example from GitHub and configure it to use your Okta account?
Varma Dandu
404
I tried the project cloning and building it everything was started perfectly but always getting 404’s from my okta client-id and secret.
Basically same result here as well : https://oidcdebugger.com/
My url : https://dev-910201.okta.com…
Sample:
https://dev-737523.oktaprev…
Matt Raible
Hello Varma,
I’d suggest going through the tutorial steps again to configure Okta. You said you cloned the example from GitHub, so I’m guessing all your code is correct. You can also try using the setup steps from the repo. Last time I tried this tutorial, it worked fine for me.
Varma Dandu
Thanks for the reply and yes it worked on clean install but when I try doing the same on my own project from scratch I am getting below
Identity Provider: Unknown
Error Code: invalid_request
Description: The ‘redirect_uri’ parameter must be an absolute URI that is whitelisted in the client app settings.
Do I need to modify something on UI or okta redirect_uri ?
Also tried this : https://support.okta.com/he…
Thanks in advance for your support Matt …