Getting error when adding @MicroserviceApplication in Spring Boot Project

Product/components used and version/fix level:

Cumulocity Production

Detailed explanation of the problem:

Hi, I was trying to follow this documentation Java Microservice SDK to create a hello world microservice with java sdk but while adding @MicroserviceApplication to my main class I am getting this error.

2023-06-02T10:48:55.377+05:30  INFO 15792 --- [           main] com.test.TestServiceApplication          : Starting TestServiceApplication using Java 17.0.1 with PID 15792 (C:\Solenis Projects\Test-Service\target\classes started by samanyu.mehra in C:\Solenis Projects\Test-Service)
2023-06-02T10:48:55.383+05:30  INFO 15792 --- [           main] com.test.TestServiceApplication          : No active profile set, falling back to 1 default profile: "default"
2023-06-02T10:48:55.967+05:30  WARN 15792 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.test.TestServiceApplication]: class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist
2023-06-02T10:48:55.992+05:30  INFO 15792 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-06-02T10:48:56.045+05:30 ERROR 15792 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.test.TestServiceApplication]: class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:524) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:304) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:243) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:196) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:164) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:398) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:283) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:344) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:115) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:747) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:565) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.6.jar:3.0.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.6.jar:3.0.6]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.6.jar:3.0.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.6.jar:3.0.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.6.jar:3.0.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[spring-boot-3.0.6.jar:3.0.6]
	at com.test.TestServiceApplication.main(TestServiceApplication.java:14) ~[classes/:na]
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:211) ~[spring-core-6.0.8.jar:6.0.8]
	at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:54) ~[spring-core-6.0.8.jar:6.0.8]
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:48) ~[spring-core-6.0.8.jar:6.0.8]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-6.0.8.jar:6.0.8]
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86) ~[spring-boot-3.0.6.jar:3.0.6]
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73) ~[spring-boot-3.0.6.jar:3.0.6]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:610) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:923) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:334) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:243) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:514) ~[spring-context-6.0.8.jar:6.0.8]
	... 17 common frames omitted


Process finished with exit code 1

My Controller class:

package com.test.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @GetMapping("/")
    public String sayHello(){
        return "Hello";
    }
}

My pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.0.6</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.test</groupId>
	<artifactId>Test-Service</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>Test-Service</name>
	<description>Demo project for Spring Boot</description>
	<properties>
		<java.version>17</java.version>
		<c8y.version>1015.0.249</c8y.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.nsn.cumulocity.clients-java</groupId>
			<artifactId>microservice-autoconfigure</artifactId>
			<version>${c8y.version}</version>
		</dependency>

		<dependency>
			<groupId>com.nsn.cumulocity.model</groupId>
			<artifactId>device-capability-model</artifactId>
			<version>${c8y.version}</version>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>
							<groupId>org.projectlombok</groupId>
							<artifactId>lombok</artifactId>
						</exclude>
					</excludes>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>cumulocity</id>
			<layout>default</layout>
			<url>https://download.cumulocity.com/maven/repository</url>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>public</id>
			<url>https://download.cumulocity.com/maven/repository</url>
		</pluginRepository>
	</pluginRepositories>
</project>

My Main class:

package com.test;

import com.cumulocity.microservice.autoconfigure.MicroserviceApplication;
import org.springframework.boot.SpringApplication;

@MicroserviceApplication
public class TestServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(TestServiceApplication.class, args);
    }

}

I think internally maybe one of the dependencies mentioned in the documentation is using Spring Security but can you please help me out here. I really want to try Java SDK but this is a blocker and I dont know how to solve this. Hoping for a quick response!

Best Regards,
Samanyu

Please check if you configured the app correctly, please application.properties file
##################################################################
application.name=Test-Service
server.port=80
C8Y.baseURL =
C8Y.bootstrap.tenant =
C8Y.bootstrap.user =
C8Y.bootstrap.password =
C8Y.microservice.isolation = MULTI_TENANT
#################################################################

Hi Matiur,

I haven’t added those configuration in my props file yet. I thought first we need to add @MicroserviceApplication, deploy it and then we will populate it. I think for local I need to populate these values and when i am deploying it it will automatically populate these values right?

Also, I have 1 more query, it will also work for PER_TENANT right?

Thanks & Regards,
Samanyu

Regarding you original question: my guess is that there is a conflict between the Spring Boot version you include and the one that comes with the SDK. If you want to do a Spring Boot application with the Java SDK, you do not need to include Spring Boot yourself.

Here are some templates, that give you an idea:

Hi Harald,

I changed version of cumulocity to 1011.6.0 and spring boot to 2.7.0. But, now I am getting this error:

C:\jdk-17.0.1\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1\lib\idea_rt.jar=50127:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Solenis Projects\Test-Service\target\classes;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.7.0\spring-boot-starter-web-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter\2.7.0\spring-boot-starter-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot\2.7.0\spring-boot-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.7.0\spring-boot-autoconfigure-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.7.0\spring-boot-starter-logging-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;C:\Users\samanyu.mehra\.m2\repository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;C:\Users\samanyu.mehra\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\samanyu.mehra\.m2\repository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.7.0\spring-boot-starter-json-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.13.3\jackson-databind-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.13.3\jackson-annotations-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.13.3\jackson-core-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.3\jackson-datatype-jdk8-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.3\jackson-datatype-jsr310-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.3\jackson-module-parameter-names-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.7.0\spring-boot-starter-tomcat-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.63\tomcat-embed-core-9.0.63.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.63\tomcat-embed-el-9.0.63.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.63\tomcat-embed-websocket-9.0.63.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-web\5.3.20\spring-web-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-beans\5.3.20\spring-beans-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-webmvc\5.3.20\spring-webmvc-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-aop\5.3.20\spring-aop-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-context\5.3.20\spring-context-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-expression\5.3.20\spring-expression-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\projectlombok\lombok\1.18.24\lombok-1.18.24.jar;C:\Users\samanyu.mehra\.m2\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-core\5.3.20\spring-core-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-jcl\5.3.20\spring-jcl-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-autoconfigure\1011.6.0\microservice-autoconfigure-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-context\1011.6.0\microservice-context-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\guava\guava\29.0-jre\guava-29.0-jre.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\checkerframework\checker-qual\2.11.1\checker-qual-2.11.1.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\errorprone\error_prone_annotations\2.3.4\error_prone_annotations-2.3.4.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-subscription\1011.6.0\microservice-subscription-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\java-client\1011.6.0\java-client-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\model\rest-representation\1011.6.0\rest-representation-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\model\realtime-model\1011.6.0\realtime-model-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\connectors\jersey-apache-connector\2.35\jersey-apache-connector-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\httpcomponents\httpcore\4.4.15\httpcore-4.4.15.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\core\jersey-common\2.35\jersey-common-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\osgi-resource-locator\1.0.3\osgi-resource-locator-1.0.3.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\core\jersey-client\2.35\jersey-client-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\external\jakarta.inject\2.6.1\jakarta.inject-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\media\jersey-media-multipart\2.35\jersey-media-multipart-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\jvnet\mimepull\mimepull\1.10.0\mimepull-1.10.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\ext\jersey-spring5\2.35\jersey-spring5-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\core\jersey-server\2.35\jersey-server-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\inject\jersey-hk2\2.35\jersey-hk2-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-locator\2.6.1\hk2-locator-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\external\aopalliance-repackaged\2.6.1\aopalliance-repackaged-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\javassist\javassist\3.25.0-GA\javassist-3.25.0-GA.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\containers\jersey-container-servlet-core\2.35\jersey-container-servlet-core-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2\2.6.1\hk2-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-utils\2.6.1\hk2-utils-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-api\2.6.1\hk2-api-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-core\2.6.1\hk2-core-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-runlevel\2.6.1\hk2-runlevel-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\class-model\2.6.1\class-model-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm-analysis\7.1\asm-analysis-7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm-commons\7.1\asm-commons-7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm-tree\7.1\asm-tree-7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm-util\7.1\asm-util-7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\spring-bridge\2.6.1\spring-bridge-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\com\sun\activation\jakarta.activation\1.2.2\jakarta.activation-1.2.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\json\json\20190722\json-20190722.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-logging\1011.6.0\microservice-logging-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-properties\1011.6.0\microservice-properties-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-security\1011.6.0\microservice-security-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-security\2.7.0\spring-boot-starter-security-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-config\5.7.1\spring-security-config-5.7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-core\5.7.1\spring-security-core-5.7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-crypto\5.7.1\spring-security-crypto-5.7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-web\5.7.1\spring-security-web-5.7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-jwt\1.1.0.RELEASE\spring-security-jwt-1.1.0.RELEASE.jar;C:\Users\samanyu.mehra\.m2\repository\org\bouncycastle\bcpkix-jdk15on\1.64\bcpkix-jdk15on-1.64.jar;C:\Users\samanyu.mehra\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.64\bcprov-jdk15on-1.64.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-platform-api\1011.6.0\microservice-platform-api-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-monitoring\1011.6.0\microservice-monitoring-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-actuator\2.7.0\spring-boot-starter-actuator-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-actuator-autoconfigure\2.7.0\spring-boot-actuator-autoconfigure-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-actuator\2.7.0\spring-boot-actuator-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\micrometer\micrometer-core\1.9.0\micrometer-core-1.9.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\hdrhistogram\HdrHistogram\2.1.12\HdrHistogram-2.1.12.jar;C:\Users\samanyu.mehra\.m2\repository\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;C:\Users\samanyu.mehra\.m2\repository\io\micrometer\micrometer-registry-prometheus\1.9.0\micrometer-registry-prometheus-1.9.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient_common\0.15.0\simpleclient_common-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient\0.15.0\simpleclient-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient_tracer_otel\0.15.0\simpleclient_tracer_otel-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient_tracer_common\0.15.0\simpleclient_tracer_common-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient_tracer_otel_agent\0.15.0\simpleclient_tracer_otel_agent-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-settings\1011.6.0\microservice-settings-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\model\device-capability-model\1011.6.0\device-capability-model-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\model\core-model\1011.6.0\core-model-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\dependencies\osgi\svenson\1.5.8-1011.6.0\svenson-1.5.8-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.36\jcl-over-slf4j-1.7.36.jar;C:\Users\samanyu.mehra\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\samanyu.mehra\.m2\repository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar;C:\Users\samanyu.mehra\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\samanyu.mehra\.m2\repository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\dependencies\osgi\json-path\1.2.0-1011.6.0\json-path-1.2.0-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\dependencies\osgi\json-smart\2.1.0-1011.6.0\json-smart-2.1.0-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm\9.1\asm-9.1.jar;C:\Users\samanyu.mehra\.m2\repository\joda-time\joda-time\2.9.4\joda-time-2.9.4.jar;C:\Users\samanyu.mehra\.m2\repository\jakarta\ws\rs\jakarta.ws.rs-api\2.1.6\jakarta.ws.rs-api-2.1.6.jar;C:\Users\samanyu.mehra\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\cometd\java\cometd-java-client\3.0.10\cometd-java-client-3.0.10.jar;C:\Users\samanyu.mehra\.m2\repository\org\cometd\java\bayeux-api\3.0.10\bayeux-api-3.0.10.jar;C:\Users\samanyu.mehra\.m2\repository\org\cometd\java\cometd-java-common\3.0.10\cometd-java-common-3.0.10.jar;C:\Users\samanyu.mehra\.m2\repository\org\eclipse\jetty\jetty-util-ajax\9.4.46.v20220331\jetty-util-ajax-9.4.46.v20220331.jar;C:\Users\samanyu.mehra\.m2\repository\org\eclipse\jetty\jetty-util\9.4.46.v20220331\jetty-util-9.4.46.v20220331.jar" com.test.TestServiceApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.0)

2023-06-02 11:35:14.434  INFO 22296 --- [           main] com.test.TestServiceApplication          : Starting TestServiceApplication using Java 17.0.1 on LP-5CG0471TN4 with PID 22296 (C:\Solenis Projects\Test-Service\target\classes started by samanyu.mehra in C:\Solenis Projects\Test-Service)
2023-06-02 11:35:14.444  INFO 22296 --- [           main] com.test.TestServiceApplication          : No active profile set, falling back to 1 default profile: "default"
2023-06-02 11:35:16.298  INFO 22296 --- [           main] o.s.c.a.ConfigurationClassEnhancer       : @Bean method EnableContextSupportConfiguration.propertySourcesPlaceholderConfigurer is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details.
2023-06-02 11:35:16.353  INFO 22296 --- [           main] o.s.c.a.ConfigurationClassEnhancer       : @Bean method EnableContextSupportConfiguration.contextScopeConfigurer is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details.
2023-06-02 11:35:16.600  INFO 22296 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'com.cumulocity.microservice.security.annotation.UserDetailsServiceConfiguration' of type [com.cumulocity.microservice.security.annotation.UserDetailsServiceConfiguration$$EnhancerBySpringCGLIB$$f4b0d74] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-06-02 11:35:16.650  INFO 22296 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'applicationApi' of type [org.springframework.aop.scope.ScopedProxyFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-06-02 11:35:16.650  INFO 22296 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'applicationApi' of type [com.cumulocity.microservice.subscription.repository.application.ApplicationApi$$EnhancerBySpringCGLIB$$7d3df49] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-06-02 11:35:16.659  INFO 22296 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'securityExpressionService' of type [com.cumulocity.microservice.security.service.impl.SecurityExpressionServiceImpl] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-06-02 11:35:16.659  INFO 22296 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'com.cumulocity.microservice.security.annotation.EnableGlobalMethodSecurityConfiguration' of type [com.cumulocity.microservice.security.annotation.EnableGlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$5cb09bcb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-06-02 11:35:17.442  INFO 22296 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-06-02 11:35:17.457  INFO 22296 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-06-02 11:35:17.457  INFO 22296 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.63]
2023-06-02 11:35:18.512  INFO 22296 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-06-02 11:35:18.512  INFO 22296 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3966 ms
2023-06-02 11:35:18.594 ERROR 22296 --- [           main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'postAuthenticateFilterRegistration' defined in class path resource [com/cumulocity/microservice/security/filter/config/FilterRegistrationConfiguration.class]: Unsatisfied dependency expressed through method 'postAuthenticateFilterRegistration' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'postAuthenticateServletFilter': Unsatisfied dependency expressed through field 'credentialsResolvers'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'OAuthPostAuthorizationContextProvider': Unsatisfied dependency expressed through method 'setSubscriptionsService' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'microserviceSubscriptionsServiceImpl' defined in URL [jar:file:/C:/Users/samanyu.mehra/.m2/repository/com/nsn/cumulocity/clients-java/microservice-subscription/1011.6.0/microservice-subscription-1011.6.0.jar!/com/cumulocity/microservice/subscription/service/impl/MicroserviceSubscriptionsServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'platformProperties' defined in com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.subscription.model.core.PlatformProperties]: Factory method 'platformProperties' threw exception; nested exception is java.lang.IllegalStateException: Please set up application name
2023-06-02 11:35:18.642  INFO 22296 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-06-02 11:35:18.652  WARN 22296 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2023-06-02 11:35:18.673  INFO 22296 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-06-02 11:35:18.724 ERROR 22296 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.20.jar:5.3.20]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.0.jar:2.7.0]
	at com.test.TestServiceApplication.main(TestServiceApplication.java:11) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:479) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.7.0.jar:2.7.0]
	... 8 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'postAuthenticateFilterRegistration' defined in class path resource [com/cumulocity/microservice/security/filter/config/FilterRegistrationConfiguration.class]: Unsatisfied dependency expressed through method 'postAuthenticateFilterRegistration' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'postAuthenticateServletFilter': Unsatisfied dependency expressed through field 'credentialsResolvers'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'OAuthPostAuthorizationContextProvider': Unsatisfied dependency expressed through method 'setSubscriptionsService' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'microserviceSubscriptionsServiceImpl' defined in URL [jar:file:/C:/Users/samanyu.mehra/.m2/repository/com/nsn/cumulocity/clients-java/microservice-subscription/1011.6.0/microservice-subscription-1011.6.0.jar!/com/cumulocity/microservice/subscription/service/impl/MicroserviceSubscriptionsServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'platformProperties' defined in com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.subscription.model.core.PlatformProperties]: Factory method 'platformProperties' threw exception; nested exception is java.lang.IllegalStateException: Please set up application name
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:212) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:203) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:97) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:86) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:262) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:236) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5219) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) ~[tomcat-embed-core-9.0.63.jar:9.0.63]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-2.7.0.jar:2.7.0]
	... 13 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'postAuthenticateServletFilter': Unsatisfied dependency expressed through field 'credentialsResolvers'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'OAuthPostAuthorizationContextProvider': Unsatisfied dependency expressed through method 'setSubscriptionsService' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'microserviceSubscriptionsServiceImpl' defined in URL [jar:file:/C:/Users/samanyu.mehra/.m2/repository/com/nsn/cumulocity/clients-java/microservice-subscription/1011.6.0/microservice-subscription-1011.6.0.jar!/com/cumulocity/microservice/subscription/service/impl/MicroserviceSubscriptionsServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'platformProperties' defined in com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.subscription.model.core.PlatformProperties]: Factory method 'platformProperties' threw exception; nested exception is java.lang.IllegalStateException: Please set up application name
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.20.jar:5.3.20]
	... 53 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'OAuthPostAuthorizationContextProvider': Unsatisfied dependency expressed through method 'setSubscriptionsService' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'microserviceSubscriptionsServiceImpl' defined in URL [jar:file:/C:/Users/samanyu.mehra/.m2/repository/com/nsn/cumulocity/clients-java/microservice-subscription/1011.6.0/microservice-subscription-1011.6.0.jar!/com/cumulocity/microservice/subscription/service/impl/MicroserviceSubscriptionsServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'platformProperties' defined in com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.subscription.model.core.PlatformProperties]: Factory method 'platformProperties' threw exception; nested exception is java.lang.IllegalStateException: Please set up application name
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:767) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:719) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1607) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1571) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1460) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1347) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.20.jar:5.3.20]
	... 68 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'microserviceSubscriptionsServiceImpl' defined in URL [jar:file:/C:/Users/samanyu.mehra/.m2/repository/com/nsn/cumulocity/clients-java/microservice-subscription/1011.6.0/microservice-subscription-1011.6.0.jar!/com/cumulocity/microservice/subscription/service/impl/MicroserviceSubscriptionsServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'platformProperties' defined in com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.subscription.model.core.PlatformProperties]: Factory method 'platformProperties' threw exception; nested exception is java.lang.IllegalStateException: Please set up application name
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:759) ~[spring-beans-5.3.20.jar:5.3.20]
	... 85 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'platformProperties' defined in com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.subscription.model.core.PlatformProperties]: Factory method 'platformProperties' threw exception; nested exception is java.lang.IllegalStateException: Please set up application name
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.20.jar:5.3.20]
	... 98 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.subscription.model.core.PlatformProperties]: Factory method 'platformProperties' threw exception; nested exception is java.lang.IllegalStateException: Please set up application name
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.20.jar:5.3.20]
	... 112 common frames omitted
Caused by: java.lang.IllegalStateException: Please set up application name
	at com.cumulocity.microservice.subscription.model.core.PlatformProperties$PlatformPropertiesProvider.platformProperties(PlatformProperties.java:177) ~[microservice-subscription-1011.6.0.jar:na]
	at com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration.platformProperties(EnableMicroserviceSubscriptionConfiguration.java:54) ~[microservice-subscription-1011.6.0.jar:na]
	at com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration$$EnhancerBySpringCGLIB$$8b9ef844.CGLIB$platformProperties$0(<generated>) ~[microservice-subscription-1011.6.0.jar:na]
	at com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration$$EnhancerBySpringCGLIB$$8b9ef844$$FastClassBySpringCGLIB$$7887eb2e.invoke(<generated>) ~[microservice-subscription-1011.6.0.jar:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.20.jar:5.3.20]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.20.jar:5.3.20]
	at com.cumulocity.microservice.subscription.annotation.EnableMicroserviceSubscriptionConfiguration$$EnhancerBySpringCGLIB$$8b9ef844.platformProperties(<generated>) ~[microservice-subscription-1011.6.0.jar:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.20.jar:5.3.20]
	... 113 common frames omitted


Process finished with exit code 1

Is it possible that i need to configure props file first before using this annotation?

yes, first you have to set the application name:
https://cumulocity.com/guides/microservice-sdk/java/#configure-the-microservice-application

if you want to run your microservice locally, you also need to acquire the other properties like tenant and bootstrap user:
https://cumulocity.com/guides/microservice-sdk/java/#running-the-microservice-locally

Hi Harald,

I deployed my service and populated my props file with bootstrap credentials. Everything is working fine now i am not getting any errors but the issue is when I am trying to access my endpoint “/” on postman I am getting 401 Unauthorized message.

But when I am hitting /health endpoint provided by @MicroserviceApplication then I am getting the response.

So how can I access my endpoint that I have declared, do I need to do some security configuration?

Thanks & Regards,
Samanyu

You have to provide basic Authentication details.
Select Basic in authorization and provide your tenant credential of access your microservice.
User: tenant/user_id
Password: tenant password

I already tried that, but I am still getting 401 Unauthorized. I tried to send a request on a different endpoint, and I am still getting 401 error, maybe my application is not able to locate the endpoint that’s why I am getting this error. What would be the solution for this because when I am using @SpringBootApplication then also I am
not able to send request to my endpoint as I have included Cumulocity dependency which includes microservice-security that doesnt allow to hit the endpoints. I get a error message like this:

C:\jdk-17.0.1\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1\lib\idea_rt.jar=50746:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Solenis Projects\Test-Service\target\classes;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.7.0\spring-boot-starter-web-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter\2.7.0\spring-boot-starter-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot\2.7.0\spring-boot-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.7.0\spring-boot-autoconfigure-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.7.0\spring-boot-starter-logging-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;C:\Users\samanyu.mehra\.m2\repository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;C:\Users\samanyu.mehra\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\samanyu.mehra\.m2\repository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.7.0\spring-boot-starter-json-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.13.3\jackson-databind-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.13.3\jackson-annotations-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.13.3\jackson-core-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.3\jackson-datatype-jdk8-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.3\jackson-datatype-jsr310-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.3\jackson-module-parameter-names-2.13.3.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.7.0\spring-boot-starter-tomcat-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.63\tomcat-embed-core-9.0.63.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.63\tomcat-embed-el-9.0.63.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.63\tomcat-embed-websocket-9.0.63.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-web\5.3.20\spring-web-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-beans\5.3.20\spring-beans-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-webmvc\5.3.20\spring-webmvc-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-aop\5.3.20\spring-aop-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-context\5.3.20\spring-context-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-expression\5.3.20\spring-expression-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\projectlombok\lombok\1.18.24\lombok-1.18.24.jar;C:\Users\samanyu.mehra\.m2\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-core\5.3.20\spring-core-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\spring-jcl\5.3.20\spring-jcl-5.3.20.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-autoconfigure\1011.6.0\microservice-autoconfigure-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-context\1011.6.0\microservice-context-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\guava\guava\29.0-jre\guava-29.0-jre.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\checkerframework\checker-qual\2.11.1\checker-qual-2.11.1.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\errorprone\error_prone_annotations\2.3.4\error_prone_annotations-2.3.4.jar;C:\Users\samanyu.mehra\.m2\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-subscription\1011.6.0\microservice-subscription-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\java-client\1011.6.0\java-client-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\model\rest-representation\1011.6.0\rest-representation-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\model\realtime-model\1011.6.0\realtime-model-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\connectors\jersey-apache-connector\2.35\jersey-apache-connector-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\httpcomponents\httpcore\4.4.15\httpcore-4.4.15.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\core\jersey-common\2.35\jersey-common-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\osgi-resource-locator\1.0.3\osgi-resource-locator-1.0.3.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\core\jersey-client\2.35\jersey-client-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\external\jakarta.inject\2.6.1\jakarta.inject-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\media\jersey-media-multipart\2.35\jersey-media-multipart-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\jvnet\mimepull\mimepull\1.10.0\mimepull-1.10.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\ext\jersey-spring5\2.35\jersey-spring5-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\core\jersey-server\2.35\jersey-server-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\inject\jersey-hk2\2.35\jersey-hk2-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-locator\2.6.1\hk2-locator-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\external\aopalliance-repackaged\2.6.1\aopalliance-repackaged-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\javassist\javassist\3.25.0-GA\javassist-3.25.0-GA.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\jersey\containers\jersey-container-servlet-core\2.35\jersey-container-servlet-core-2.35.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2\2.6.1\hk2-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-utils\2.6.1\hk2-utils-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-api\2.6.1\hk2-api-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-core\2.6.1\hk2-core-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\hk2-runlevel\2.6.1\hk2-runlevel-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\class-model\2.6.1\class-model-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm-analysis\7.1\asm-analysis-7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm-commons\7.1\asm-commons-7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm-tree\7.1\asm-tree-7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm-util\7.1\asm-util-7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\glassfish\hk2\spring-bridge\2.6.1\spring-bridge-2.6.1.jar;C:\Users\samanyu.mehra\.m2\repository\com\sun\activation\jakarta.activation\1.2.2\jakarta.activation-1.2.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\json\json\20190722\json-20190722.jar;C:\Users\samanyu.mehra\.m2\repository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-logging\1011.6.0\microservice-logging-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-properties\1011.6.0\microservice-properties-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-security\1011.6.0\microservice-security-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-security\2.7.0\spring-boot-starter-security-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-config\5.7.1\spring-security-config-5.7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-core\5.7.1\spring-security-core-5.7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-crypto\5.7.1\spring-security-crypto-5.7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-web\5.7.1\spring-security-web-5.7.1.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\security\spring-security-jwt\1.1.0.RELEASE\spring-security-jwt-1.1.0.RELEASE.jar;C:\Users\samanyu.mehra\.m2\repository\org\bouncycastle\bcpkix-jdk15on\1.64\bcpkix-jdk15on-1.64.jar;C:\Users\samanyu.mehra\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.64\bcprov-jdk15on-1.64.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-platform-api\1011.6.0\microservice-platform-api-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-monitoring\1011.6.0\microservice-monitoring-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-starter-actuator\2.7.0\spring-boot-starter-actuator-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-actuator-autoconfigure\2.7.0\spring-boot-actuator-autoconfigure-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\springframework\boot\spring-boot-actuator\2.7.0\spring-boot-actuator-2.7.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\micrometer\micrometer-core\1.9.0\micrometer-core-1.9.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\hdrhistogram\HdrHistogram\2.1.12\HdrHistogram-2.1.12.jar;C:\Users\samanyu.mehra\.m2\repository\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;C:\Users\samanyu.mehra\.m2\repository\io\micrometer\micrometer-registry-prometheus\1.9.0\micrometer-registry-prometheus-1.9.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient_common\0.15.0\simpleclient_common-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient\0.15.0\simpleclient-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient_tracer_otel\0.15.0\simpleclient_tracer_otel-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient_tracer_common\0.15.0\simpleclient_tracer_common-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\io\prometheus\simpleclient_tracer_otel_agent\0.15.0\simpleclient_tracer_otel_agent-0.15.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\clients-java\microservice-settings\1011.6.0\microservice-settings-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\model\device-capability-model\1011.6.0\device-capability-model-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\model\core-model\1011.6.0\core-model-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\dependencies\osgi\svenson\1.5.8-1011.6.0\svenson-1.5.8-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.36\jcl-over-slf4j-1.7.36.jar;C:\Users\samanyu.mehra\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\samanyu.mehra\.m2\repository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar;C:\Users\samanyu.mehra\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\samanyu.mehra\.m2\repository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\dependencies\osgi\json-path\1.2.0-1011.6.0\json-path-1.2.0-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\com\nsn\cumulocity\dependencies\osgi\json-smart\2.1.0-1011.6.0\json-smart-2.1.0-1011.6.0.jar;C:\Users\samanyu.mehra\.m2\repository\org\ow2\asm\asm\9.1\asm-9.1.jar;C:\Users\samanyu.mehra\.m2\repository\joda-time\joda-time\2.9.4\joda-time-2.9.4.jar;C:\Users\samanyu.mehra\.m2\repository\jakarta\ws\rs\jakarta.ws.rs-api\2.1.6\jakarta.ws.rs-api-2.1.6.jar;C:\Users\samanyu.mehra\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\samanyu.mehra\.m2\repository\org\cometd\java\cometd-java-client\3.0.10\cometd-java-client-3.0.10.jar;C:\Users\samanyu.mehra\.m2\repository\org\cometd\java\bayeux-api\3.0.10\bayeux-api-3.0.10.jar;C:\Users\samanyu.mehra\.m2\repository\org\cometd\java\cometd-java-common\3.0.10\cometd-java-common-3.0.10.jar;C:\Users\samanyu.mehra\.m2\repository\org\eclipse\jetty\jetty-util-ajax\9.4.46.v20220331\jetty-util-ajax-9.4.46.v20220331.jar;C:\Users\samanyu.mehra\.m2\repository\org\eclipse\jetty\jetty-util\9.4.46.v20220331\jetty-util-9.4.46.v20220331.jar" com.test.TestServiceApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.0)

2023-06-02 17:44:50.985  INFO 22444 --- [           main] com.test.TestServiceApplication          : Starting TestServiceApplication using Java 17.0.1 on LP-5CG0471TN4 with PID 22444 (C:\Solenis Projects\Test-Service\target\classes started by samanyu.mehra in C:\Solenis Projects\Test-Service)
2023-06-02 17:44:50.995  INFO 22444 --- [           main] com.test.TestServiceApplication          : No active profile set, falling back to 1 default profile: "default"
2023-06-02 17:44:55.169  INFO 22444 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-06-02 17:44:55.199  INFO 22444 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-06-02 17:44:55.200  INFO 22444 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.63]
2023-06-02 17:44:57.137  INFO 22444 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-06-02 17:44:57.138  INFO 22444 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5998 ms
2023-06-02 17:44:59.475  WARN 22444 --- [           main] .s.s.UserDetailsServiceAutoConfiguration : 

Using generated security password: 16043acd-dd0a-41eb-8a1d-1c4e8bc1b653

This generated password is for development use only. Your security configuration must be updated before running your application in production.

2023-06-02 17:44:59.740  INFO 22444 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'
2023-06-02 17:44:59.761  INFO 22444 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@52f6900a, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@7bbcf6f0, org.springframework.security.web.context.SecurityContextPersistenceFilter@1c61eda5, org.springframework.security.web.header.HeaderWriterFilter@64b0d1fa, org.springframework.web.filter.CorsFilter@2b80e5a9, org.springframework.security.web.csrf.CsrfFilter@2d5a1588, org.springframework.security.web.authentication.logout.LogoutFilter@2c26ba07, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@4e0cc334, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@7f0b93b4, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@4cc01c7f, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@5bde57ab, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@59838256, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@131a7516, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@2a50b32d, org.springframework.security.web.session.SessionManagementFilter@12d2ddde, org.springframework.security.web.access.ExceptionTranslationFilter@3e546734, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@2233cac0]
2023-06-02 17:44:59.927  INFO 22444 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-06-02 17:44:59.961  INFO 22444 --- [           main] com.test.TestServiceApplication          : Started TestServiceApplication in 10.475 seconds (JVM running for 15.935)
2023-06-02 17:45:13.659  INFO 22444 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-06-02 17:45:13.660  INFO 22444 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2023-06-02 17:45:13.663  INFO 22444 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Completed initialization in 3 ms
2023-06-02 17:45:14.077  WARN 22444 --- [nio-8080-exec-2] o.a.c.util.SessionIdGeneratorBase        : Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [264] milliseconds.

When I am using @MicroserviceApplication then also I am not able to send the request. There is some internal security restriction that needs to be bypassed.

Also, when I am hitting the /health endpoint, I am not passing any credentials. So I dont think any credentials will be needed as I have already configured the bootstrap credentials locally.

Thanks & Regards,
Samanyu

Hi,

When I am trying to do dependency injection of the Inventory API and fetch records, I am getting this error.

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-06-07 13:59:08.759 ERROR 14396 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testServiceApplication': Invocation of init method failed; nested exception is org.springframework.beans.factory.support.ScopeNotActiveException: Error creating bean with name 'scopedTarget.inventoryApi': Scope 'tenant' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: Not within any context!
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.20.jar:5.3.20]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.20.jar:5.3.20]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.0.jar:2.7.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.0.jar:2.7.0]
	at com.test.TestServiceApplication.main(TestServiceApplication.java:20) ~[classes/:na]
Caused by: org.springframework.beans.factory.support.ScopeNotActiveException: Error creating bean with name 'scopedTarget.inventoryApi': Scope 'tenant' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: Not within any context!
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:383) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35) ~[spring-aop-5.3.20.jar:5.3.20]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:195) ~[spring-aop-5.3.20.jar:5.3.20]
	at jdk.proxy2/jdk.proxy2.$Proxy98.getSupportedSeries(Unknown Source) ~[na:na]
	at com.test.service.RestClientServiceImpl3B.sayHello(RestClientServiceImpl3B.java:30) ~[classes/:na]
	at com.test.TestServiceApplication.doSomething(TestServiceApplication.java:25) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) ~[spring-beans-5.3.20.jar:5.3.20]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ~[spring-beans-5.3.20.jar:5.3.20]
	... 18 common frames omitted
Caused by: java.lang.IllegalStateException: Not within any context!
	at com.cumulocity.microservice.context.ContextServiceImpl.getContext(ContextServiceImpl.java:41) ~[microservice-context-1011.6.0.jar:na]
	at com.cumulocity.microservice.context.annotation.EnableContextSupportConfiguration$1.getContextId(EnableContextSupportConfiguration.java:64) ~[microservice-context-1011.6.0.jar:na]
	at com.cumulocity.microservice.context.scope.BaseScope.doGetSynchronized(BaseScope.java:75) ~[microservice-context-1011.6.0.jar:na]
	at com.cumulocity.microservice.context.scope.BaseScope.get(BaseScope.java:67) ~[microservice-context-1011.6.0.jar:na]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:371) ~[spring-beans-5.3.20.jar:5.3.20]
	... 31 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:52340', transport: 'socket'

Process finished with exit code 1

What I did is I created 1 service class and added this method in that.

    @Autowired
    InventoryApi inventoryApi;

    public SupportedSeriesRepresentation sayHello(String deviceId){
        final SupportedSeriesRepresentation supportedSeries = inventoryApi.getSupportedSeries(new GId(deviceId));

        return supportedSeries;
    }

Then I called the method in my main app as I am not able to call my endpoints.

    @PostConstruct
    public void doSomething(){
        log.info("PostConstruct: "+restClient.sayHello("50977"));
    }

And after running I am getting that error.
What does this error mean? Do you have any solution for this?

Regards,
Samanyu

Hi,

I am able to access my endpoint after deploying it to cumulocity leaving some properties blank in props file so that cumulocity can autofill it. Now I have 2 issues:

  1. I am using this endpoint /application/applications/:id/bootstrapUser to get my bootstrap credentials for my app. Maybe the credentials that i am getting are wrong and thats why I am facing issues while running the program locally. So can you help me finding the right endpoint or how to solve this issue?

  2. When I am trying to access the inventory api from the deployed microservice I am getting

com.cumulocity.sdk.client.SDKException: Http status code: 403
{error="security/Forbidden",message="Access is denied",info="https://www.cumulocity.com/guides/reference/rest-implementation//#a-name-error-reporting-a-error-reporting",details="null"}

this exception. Why am I getting this, do I need to set some extra roles or anything?

Regards,
Samanyu

You can’t use the bootstrapUser to perform a service call. The bootstrapUser is only allowed to retrieve the Service User credentials which then of course you can use to do service calls.
You have to provide the bootstrapUser details in the yml file so the SDK uses it to retrieve the service user automatically. There are a lot of examples in our github repository.

To your other problem:
Similar issue. You calling a service bean without being in any context (neither user nor tenant context). So either you call it directly from the rest controller or you use the MicroserviceSubscriptionsService to and runForEachTenant or other functions to get a context. Again a lot of examples at github:

for example

Hi Stefan,

I have a single tenant so I won’t be using runForEachTenant function. The github link that you mentioned, I read the readme file and the code, I saw in the readme file that they are also hitting the same endpoint like I did and configuring the props file accordingly. I also did the same thing to make it run locally but it is not running as I have mentioned the issue above. I have written the code similar to yours but I dont know the real issue.

Apart from that when I have deployed my service on cumulocity I am getting access denied error, I left 4 props blank as you did in the context github application props file.

My Props file:

#Do not edit, version properties are set at build time
c8y.version=@c8y.version@
microservice.version=@project.version@

server.port=8080

#Cumulocity configuration for running locally and connecting to cumulocity
application.name=test-microservice
C8Y.bootstrap.register=true
C8Y.bootstrap.tenant=<tenant>
C8Y.baseURL=<tenant_url>
C8Y.bootstrap.user=<username>
C8Y.bootstrap.password=<password>
C8Y.microservice.isolation=PER_TENANT
spring.mvc.pathmatch.matching-strategy=ant_path_matcher

spring.main.allow-circular-references=true

The Json file that I am using is very basic:

{
    "apiVersion": "1",
    "version": "1.0.0",
    "provider": {
        "name": "test-service"
    },
    "isolation": "PER_TENANT",
    "requiredRoles": []
}

Am I getting the error because of this? Do i need to add any extra roles?

Regards,
Samanyu

That doesn’t matter if you have a per_tenant or multi tenant isolation, you have to call the subscriptionService!
You always have to use the the subscriptionService to be in any context with one exceptions which is when directly calling from a RestController or you explicitly want to use an user scope (see my example at github).

Please change isolation back to" multi_tenant" in you properties.yml when you want to run the microservice locally. Again, it doesn’t matter if you have that defined correctlyin your manifest which is cumulocity.json
Also please add the APIs to the requiredRoles in your manifest you want to access otherwise the service does not have access to anything!

I would urge you to start from one of the templates of this repo and do your enhancements/changes. It seems that you have a lot of misconfigured in your current project e.g empty requiredRoles, not using subscriptionService, wrong Properties in the yml etc.

Here is a basic call you should access the Service Beans:

    public List<ManagedObjectRepresentation> getAllDevicesTenant2() {
        List<ManagedObjectRepresentation> morList = new ArrayList<>();
        subscriptionsService.runForEachTenant(() -> {
            tenantInventoryApi.getManagedObjects().get().allPages().forEach(mor -> {
                morList.add(mor);
            });
        });
        return morList;
    }

Hi Stefan,

I have updated the manifest file according to my need.

{
    "apiVersion": "1",
    "version": "1.0.0",
    "provider": {
        "name": "test-service"
    },
    "isolation": "MULTI_TENANT",
    "resources": {
        "cpu": "1",
        "memory": "1024M"
    },
    "requiredRoles": [
        "ROLE_INVENTORY_READ",
        "ROLE_INVENTORY_CREATE",
        "ROLE_INVENTORY_ADMIN",
        "ROLE_MEASUREMENT_READ",
        "ROLE_MEASUREMENT_ADMIN"
    ],
    "roles": [
    ],
    "livenessProbe": {
        "httpGet": {
            "path": "/health",
            "port": 80
        },
        "initialDelaySeconds": 30,
        "periodSeconds": 10
    },
    "readinessProbe": {
        "httpGet": {
            "path": "/health",
            "port": 80
        },
        "initialDelaySeconds": 30,
        "periodSeconds": 10
    }
}

I am getting the response in my deployed service after autowiring the subscriptionService but I am still getting 401 Unauthorized when running through postman.

I ran

GET 'https://{base-url}/application/applications/{applicationId}/bootstrapUser

Response body:

{
    "password": "************************",
    "name": "servicebootstrap_templates-context",
    "tenant": "<your tenant>"
}

and copied the username, password and tenant in my props file. But still I am getting 401 Unauthorized. Can you tell me what’s could be the issue with this?
Also, can you please point me to a documentation where I can read all of this to get a better understanding.

Regards,
Samanyu

The Bootstrap User has nothing to do with the REST Request via Postman.
The bootstrap user is only used at local initial start of the microservice to fetch the service user credentials. So if you don’t have any issues in the log during startup everything is fine and you can “check” the bootstrap setup.

If you get 401 via Postman then something is wrong with the user password provided in Postman or the endpoint configuration in your RestController.
User has contain the tenant ID + user e.g. “t123456/username”. Please use any manual created user, NOT the bootstrapuser.

It is mainly documented here: General aspects - Cumulocity IoT Guides
But learning by example is much better, therefor I referred you to the template repo.

Hi Stefan,

I don’t know what’s the real issue here. I have a microservice deployed on cumulocity and it works fine with my credentials. I just tried it on local and the endpoint is working fine. Then I added cumulocity dependencies which are :

		<dependency>
			<groupId>com.nsn.cumulocity.clients-java</groupId>
			<artifactId>microservice-autoconfigure</artifactId>
			<version>${c8y.version}</version>
		</dependency>

		<dependency>
			<groupId>com.nsn.cumulocity.model</groupId>
			<artifactId>device-capability-model</artifactId>
			<version>${c8y.version}</version>
		</dependency>

<repositories>
		<repository>
			<id>cumulocity</id>
			<layout>default</layout>
			<url>https://download.cumulocity.com/maven/repository</url>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>public</id>
			<url>https://download.cumulocity.com/maven/repository</url>
		</pluginRepository>
	</pluginRepositories>

and then I added @MicroserviceApplication on my Main app and then I am not able to access my endpoint with the same credentials. There is something in that annotation that is adding some security for accessing the endpoints.

There is 1 thing that I need to know when I am accessing the health endpoint it is working with NoAuth and with BasicAuth from postman so that means I dont need to pass any credentials to call my endpoints locally in postman, right?

Also, I need to use bootstrap user because my client doesn’t want to use any user credentials instead, they want to use app credentials and use SDK to fetch data.

Hope you understand the issue and get some idea to solve this issue.

Thanks & Regards,
Samanyu

Hi Stefan,

So, I am able to run my service locally. I just changed PER_TENANT to MULTI_TENANT in my application.properties file and for calling the endpoint i just used tenant/bootstrap_username and in password i used bootstrap_password in basic auth section and I was able to access the endpoint. I have few questions though:

  1. Why it wasnt working with PER_TENANT and it is working with MULTI_TENANT.

  2. I am able to access my deployed service with my user credentials as well as bootstrap credentials. So is it an expected case? I think if we are using the app credentials the user shouldnt be allowed to use his credentials to access the service.

  3. Is there any documentation of the methods where I can see what methods do what so that I can just access those methods whichever fulfill my needs.

Regards,
Samanyu

Hi @Sam123 ,

  1. @MicroserviceApplication adds a lot of implicated dependencies and annotation including Spring Security. The health endpoint in general is without any auth requirement, all other endpoints must be authenticated with a valid cumulocity user. So no, you always have to pass Cumulocity credentials even when run it locally (except the health endpoint).
  2. The bootstrapuser is just for retrieving the service user for each tenant. I think I made this clear now multiple times. You should not use that in any other API Call of your microservice (even when it is working). The service user permissions are defined in your manifest file.
  3. (your 1.). Env. MULTI_TENANT is needed locally only (I don’t know the reason though but if you want to run your microservice locally this must be set.)
  4. (your 2.) Yes, if you don’t protect your REST endpoints this is the expected case. You can use any user without any permission to call the microservice endpoint including the bootstrapuser… still you shouldn’t do that. Internally the service user is used, that the reason you user you authenticating with doesn’t need any permission.
  5. (your 3.) There is a java doc available Overview (Cumulocity Microservice SDK)

Still I think you should have started with a pre-defined and configured microservice as a template and adapting that to your needs.

Hi Stefan,

Thank you for your response. That clears a lot of doubts of mine. I did start with a pre-defined and configured microservice only, but the problem was I didn’t understand what was going on and how it’s been done, that’s why I went for development from scratch. Also, I am not using the service user to do any API call internally so don’t worry about that.

Anyways, can you please tell me how I can protect my endpoint that will only use the bootstrap user and not any cumulocity user.

Thanks & Regards,
Samanyu