question

FiallegaJorgeITD-8921 avatar image
0 Votes"
FiallegaJorgeITD-8921 asked urizn-4579 answered

Azure Spring Cloud applications fail to access the config server - (following vanilla microsoft documentation)

I am following the tutorial for Azure Spring Cloud:
https://docs.microsoft.com/en-us/azure/spring-cloud/spring-cloud-quickstart-sample-app-introduction?pivots=programming-language-java

the repo url for this demo is: https://github.com/Azure-Samples/piggymetrics
The URI for the config server is: https://github.com/Azure-Samples/piggymetrics-config

I configured the config server and I have created the application by running

az spring-cloud app create --name gateway
az spring-cloud app create --name auth-service
az spring-cloud app create --name account-service


But when I try to deploy the gateway application
```
az spring-cloud app deploy -n gateway --jar-path ./gateway/target/gateway.jar
```
I get the following error:

Deployment failed. Correlation ID: ----. 112404: Failed to wait for deployment instances to be ready. Please check the application log (see https://aka.ms/azure-spring-cloud-doc-log ), and try again later.

and when I check the logs it seems to me that I am getting a 401 error when trying to access the config server

  :: Spring Boot ::        (v2.0.3.RELEASE)
    
 2021-02-02 17:38:21.241  INFO [gateway,,,] 1 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://piggymetrics-xxxxxxxx-asc.svc.azuremicroservices.io/config
 2021-02-02 17:38:22.327 ERROR [gateway,,,] 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
    
 java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
     at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:136) ~[spring-cloud-config-client-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
     at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94) ~[spring-cloud-context-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
     at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:633) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
     at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:373) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
     at com.piggymetrics.gateway.GatewayApplication.main(GatewayApplication.java:14) [classes!/:1.0-SNAPSHOT]
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_265]
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_265]
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_265]
     at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_265]
     at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [a15ec7d2-d970-43d7-9cce-6679bbd21dc5:1.0-SNAPSHOT]
     at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [a15ec7d2-d970-43d7-9cce-6679bbd21dc5:1.0-SNAPSHOT]
     at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [a15ec7d2-d970-43d7-9cce-6679bbd21dc5:1.0-SNAPSHOT]
     at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [a15ec7d2-d970-43d7-9cce-6679bbd21dc5:1.0-SNAPSHOT]
 Caused by: org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
     at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:94) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
     at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:79) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
     at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
     at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:766) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
     at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:724) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
     at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:680) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
     at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:600) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
     at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:218) ~[spring-cloud-config-client-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
     at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:96) ~[spring-cloud-config-client-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
     ... 15 common frames omitted

I basically would like to get through the quickstarts.
(I have tried upgrading the spring boot version from 2.0.3 2.1.* but I get the same error. If I try to go to a 2.3.8 then I have compilation errors)

Any help would be appreciated.



azure-spring-cloud
· 16
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @FiallegaJorgeITD-8921, thanks for reaching out to us! Happy to help. To resolve your issue, could you further tell me if you have made any changes in Gateway pom.xml or Main pom.xml? If yes, please do share them.



0 Votes 0 ·

No I did not make any changes.
If you follow the quick guide
https://docs.microsoft.com/en-us/azure/spring-cloud/spring-cloud-quickstart-sample-app-introduction?pivots=programming-language-java
step by step you will be able to reproduce the issue.

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

Which Deployment Procedure are you using here? And, from where are you deploying the solution (example local/cloud)?




0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

Just FYI - the above commands (including erroneous command for you) work for me in Powershell. Further, I am able to deploy the application successfully on Azure Sprint Cloud following those steps. Just wanted to know about above query so that I can reproduce this issue.

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

Can you try to delete everything and try again (this time in different tool than which was used last time, eg., Powershell, Bash, Maven, IntelliJ)? I suspect there is some unexpected dependency conflict that has caused this issue.

0 Votes 0 ·

@FiallegaJorgeITD-8921, Just checking in to see if you have had a chance to see the previous comments.

0 Votes 0 ·

I am sorry, I guess I did not push the "Post Your Answer before".
I did not make any changes to those files. I believe if you follow the microsoft quickstart https://docs.microsoft.com/en-us/azure/spring-cloud/spring-cloud-quickstart-sample-app-introduction?pivots=programming-language-java
you will be able to reproduce it "out of the box".

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

@FiallegaJorgeITD-8921, thanks for the reply. I followed the tutorial and I was able to deploy full application on Spring Cloud, just like shown in the tutorial.

And, I already made note that you did not make any changes, hence asking you to please share contextual details for us to solve your issue.

Asks from you:

  • Which Deployment Procedure are you using here? And, from where are you deploying the solution (example local/cloud)?

  • Can you try to delete everything and try again (this time in different tool than which was used last time, eg., Powershell, Bash, Maven, IntelliJ)?








0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

@FiallegaJorgeITD-8921, Just checking in to see if you have had a chance to see my previous comments.

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

@FiallegaJorgeITD-8921, Just checking in to see if you have had a chance to see the previous comments.

0 Votes 0 ·

OK, I will clean everything up and start from the beginning.
Thanks

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

Great, keep me posted.

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

@FiallegaJorgeITD-8921, just checking in to see if you worked on above suggestions provided by me.

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

@FiallegaJorgeITD-8921, just checking in to see if you got it working.

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

@FiallegaJorgeITD-8921, just checking in to see if the above suggestions provided by me helped you or not.

0 Votes 0 ·
singhh-msft avatar image singhh-msft FiallegaJorgeITD-8921 ·

@FiallegaJorgeITD-8921, just checking in to see if the above suggestions provided by me helped you or not.

0 Votes 0 ·
FiallegaJorgeITD-8921 avatar image
0 Votes"
FiallegaJorgeITD-8921 answered singhh-msft commented

OK. let's leave it at that then.
It can be closed.
Thanks

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@FiallegaJorgelTD-8921, does it work for you now? If yes, did the above comments help you or you did something different?

0 Votes 0 ·
AmitSinha1-2563 avatar image
0 Votes"
AmitSinha1-2563 answered

I am facing the similar issue when trying to deploy piggymetrics,. @FiallegaJorgelTD did you resolve it ?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

urizn-4579 avatar image
0 Votes"
urizn-4579 answered

for future sufferers, the reason it failed for me is because the default branch in github is now main instead of master so I had to set the label name hint in order for it to find it.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.