<p>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</p>
<p><strong>Error</strong></p>
<pre><code>java.lang.NoClassDefFoundError: org/springframework/core/env/Profiles
        at org.springframework.cloud.kubernetes.config.PropertySourceUtils.lambda$null$3(PropertySourceUtils.java:69)
        at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:239)
        at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:167)
        at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:139)
        at org.springframework.beans.factory.config.YamlPropertiesFactoryBean.createProperties(YamlPropertiesFactoryBean.java:135)
        at org.springframework.beans.factory.config.YamlPropertiesFactoryBean.getObject(YamlPropertiesFactoryBean.java:115)
        at org.springframework.cloud.kubernetes.config.PropertySourceUtils.lambda$yamlParserGenerator$4(PropertySourceUtils.java:77)
        at java.util.function.Function.lambda$andThen$1(Function.java:88)
        at org.springframework.cloud.kubernetes.config.ConfigMapPropertySource.processAllEntries(ConfigMapPropertySource.java:149)
        at org.springframework.cloud.kubernetes.config.ConfigMapPropertySource.getData(ConfigMapPropertySource.java:100)
        at org.springframework.cloud.kubernetes.config.ConfigMapPropertySource.&lt;init&gt;(ConfigMapPropertySource.java:78)
        at org.springframework.cloud.kubernetes.config.ConfigMapPropertySourceLocator.getMapPropertySourceForSingleConfigMap(ConfigMapPropertySourceLocator.java:96)
        at org.springframework.cloud.kubernetes.config.ConfigMapPropertySourceLocator.lambda$locate$0(ConfigMapPropertySourceLocator.java:79)
        at java.util.ArrayList.forEach(ArrayList.java:1259)
        at org.springframework.cloud.kubernetes.config.ConfigMapPropertySourceLocator.locate(ConfigMapPropertySourceLocator.java:78)
        at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94)
        at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:628)
        at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:364)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
        at com.daimler.daivb.msl.MbappsSnapLocalSearchServiceApplication.main(MbappsSnapLocalSearchServiceApplication.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.Profiles
        at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
</code></pre>
<p>Dependencies I am using in the application are</p>
<ol>
<li>spring-boot-starter-web - 2.0.8.RELEASE</li>
<li>gson                    - 2.3.1</li>
<li>json-lib                - 2.3</li>
<li>spring-cloud-starter-kubernetes-config -1.1.10.RELEASE</li>
<li>json                    - 20230227</li>
<li>xmlrpc-client           - 3.1.3</li>
<li>spring-security-oauth2-autoconfigure - 2.0.8.RELEASE</li>
<li>spring-security-config</li>
<li>spring-security-web</li>
<li>spring-cloud-starter-openfeign - 2.0.0.RELEASE</li>
<li>spring-cloud-starter-netflix-ribbon - 2.0.0.RELEASE</li>
<li>spring-boot-starter-actuator</li>
<li>commons-lang3           - 3.8.1</li>
<li>lombok</li>
<li>spring-cloud-starter-config - 2.0.3.RELEASE</li>
<li>micrometer-registry-prometheus - 1.2.2</li>
<li>micrometer-core - 1.2.2</li>
<li>spring-boot-starter-test</li>
<li>spring-cloud-dependencies - Finchley.SR3</li>
</ol>

Chaithra Shenoy
<p>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 <code>org.springframework.core.env.Profiles</code> class. It was introduced in Spring Framework 5.1 and Spring Boot 2.0.x uses Spring Framework 5.0.x.</p>
<p>You should update your dependency versions to ensure that they're compatible. To make it easier to do so, I would recommend using the <code>spring-cloud-dependencies</code> bom as shown on its <a href="https://spring.io/projects/spring-cloud" rel="nofollow noreferrer">project page</a>.</p>
