• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.Profiles

Resolved: Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.Profiles

0
By Isaac Tonny on 01/04/2023 Issue
Share
Facebook Twitter LinkedIn

In this post, we will see how to resolve Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.Profiles

Question:

When I run the application locally the application is up and running but when i deploy the same application in the Kubernetes cluster i am getting the error
Error
Dependencies I am using in the application are
  1. spring-boot-starter-web – 2.0.8.RELEASE
  2. gson – 2.3.1
  3. json-lib – 2.3
  4. spring-cloud-starter-kubernetes-config -1.1.10.RELEASE
  5. json – 20230227
  6. xmlrpc-client – 3.1.3
  7. spring-security-oauth2-autoconfigure – 2.0.8.RELEASE
  8. spring-security-config
  9. spring-security-web
  10. spring-cloud-starter-openfeign – 2.0.0.RELEASE
  11. spring-cloud-starter-netflix-ribbon – 2.0.0.RELEASE
  12. spring-boot-starter-actuator
  13. commons-lang3 – 3.8.1
  14. lombok
  15. spring-cloud-starter-config – 2.0.3.RELEASE
  16. micrometer-registry-prometheus – 1.2.2
  17. micrometer-core – 1.2.2
  18. spring-boot-starter-test
  19. spring-cloud-dependencies – Finchley.SR3

Best Answer:

The version of Spring Cloud Kubernetes that you are using (1.1.10.RELEASE) requires Spring Boot 2.2.x. You are using 2.0.x. This older version of Spring Boot uses an older version of Spring Framework that does not contain the org.springframework.core.env.Profiles class. It was introduced in Spring Framework 5.1 and Spring Boot 2.0.x uses Spring Framework 5.0.x.
You should update your dependency versions to ensure that they’re compatible. To make it easier to do so, I would recommend using the spring-cloud-dependencies bom as shown on its project page.

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

classnotfoundexception config java kubernetes spring-boot
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to stop a thread that has a blocking function from easygui in python

05/04/2023

Resolved: Removing null keys from a json array of objects

05/04/2023

Resolved: How can I generate at compile-time a separate OpenAPI Swagger.json file for each Controller in my ASP.NET project?

05/04/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.