Not able to connect microservice from local to tenant

I have created one microservice in my local workspace and connecting it to a specific tenant, while connecting i am getting below error . With same set-up other person is able to connect.

Note : one more thing i notices , the tenant id which i am passing in my application properties file and in “Warn” logs are differnt

C8Y.bootstrap.tenant=t5543594

“execution of task failed within tenant : t54905 - Http status code: 401”

Error logs:

2023-10-06 18:53:26.384 WARN 11160 — [ main] c.c.m.context.ContextServiceImpl : execution of task failed within tenant : t54905 - Http status code: 401
{error=“security/Unauthorized”,message=“Invalid credentials!”,info=“https://cumulocity.com/guides/reference/openapi/”}
2023-10-06 18:53:26.389 WARN 11160 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘standardJacksonObjectMapperBuilderCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration.class]: Unsatisfied dependency expressed through method ‘standardJacksonObjectMapperBuilderCustomizer’ parameter 1; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name ‘spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties’: Could not bind properties to ‘JacksonProperties’ : prefix=spring.jackson, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under ‘spring.jackson’ to org.springframework.boot.autoconfigure.jackson.JacksonProperties
2023-10-06 18:53:26.403 INFO 11160 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-10-06 18:53:26.422 INFO 11160 — [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2023-10-06 18:53:26.443 ERROR 11160 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Failed to bind properties under ‘spring.jackson’ to org.springframework.boot.autoconfigure.jackson.JacksonProperties:

Reason: com.cumulocity.sdk.client.SDKException: Http status code: 401

{error=“security/Unauthorized”,message=“Invalid credentials!”,info=“https://cumulocity.com/guides/reference/openapi/”}

Action:

Update your application’s configuration

Can you post the project here?

Please post your application.properties file(s).

Hello Kai,

Please find below details :

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

cumulocity configuration for running localy and connecting to cumulocity
application.name=ogcreatemanagedobjsdkk
C8Y.bootstrap.register=true
C8Y.bootstrap.tenant={{TenantID}}
C8Y.baseURL={{URL}}
C8Y.bootstrap.user=servicebootstrap_ogcreatemanagedobjsdkk
C8Y.bootstrap.password={{Password}}
C8Y.microservice.isolation=MULTI_TENANT

spring.mvc.pathmatch.matching-strategy=ant_path_matcher
spring.main.allow-circular-references=true

Regards/-
Prakash

Hi Prakash,
next time please do not post any secrets or credentials for you own safety :slight_smile:

Can you share the full set of logs?
Which IDE are you using?

Do you have the details above within the “application.properties” (default profile) or e.g. “application-dev.properties” file as a separate profile (here “dev”)?

Hello Kai,

Thanks Kai, I will make sure while posting some secrets. I am using eclipse IDE

All there entries were in application properties . Not using any separate properties file

Please find below full set of logs.

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

2023-10-09 13:39:17.574 INFO 21960 — [ main] c.s.g.GenerateManagedObjectsApplication : Starting GenerateManagedObjectsApplication using Java 17.0.8.1 on PCNA-PG035HCQ with PID 21960 (C:\Users\PSinha\OneDrive - Solenis LLC\Desktop\Github\IoT_CreateManagedObjects_Backend\IoT_CreateManagedObjects_Backend\target\classes started by PSinha in C:\Users\PSinha\OneDrive - Solenis LLC\Desktop\Github\IoT_CreateManagedObjects_Backend\IoT_CreateManagedObjects_Backend)
2023-10-09 13:39:17.581 INFO 21960 — [ main] c.s.g.GenerateManagedObjectsApplication : No active profile set, falling back to 1 default profile: “default”
2023-10-09 13:39:22.432 INFO 21960 — [ 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-10-09 13:39:22.537 INFO 21960 — [ 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-10-09 13:39:23.012 INFO 21960 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘com.cumulocity.microservice.security.annotation.UserDetailsServiceConfiguration’ of type [com.cumulocity.microservice.security.annotation.UserDetailsServiceConfiguration$$EnhancerBySpringCGLIB$$d6ad83c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-10-09 13:39:23.107 INFO 21960 — [ 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-10-09 13:39:23.107 INFO 21960 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘applicationApi’ of type [com.cumulocity.microservice.subscription.repository.application.ApplicationApi$$EnhancerBySpringCGLIB$$1adc662b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-10-09 13:39:23.120 INFO 21960 — [ 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-10-09 13:39:23.122 INFO 21960 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘com.cumulocity.microservice.security.annotation.EnableGlobalMethodSecurityConfiguration’ of type [com.cumulocity.microservice.security.annotation.EnableGlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$5ad06693] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-10-09 13:39:25.025 INFO 21960 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8082 (http)
2023-10-09 13:39:25.087 INFO 21960 — [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-10-09 13:39:25.088 INFO 21960 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.63]
2023-10-09 13:39:25.771 INFO 21960 — [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-10-09 13:39:25.773 INFO 21960 — [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 7990 ms
2023-10-09 13:39:25.930 INFO 21960 — [ main] bleMicroserviceSubscriptionConfiguration : Microservice repository will be build for application ‘servicebootstrap_ogcreatemanagedobjsdkk’.
2023-10-09 13:39:27.235 INFO 21960 — [ main] c.c.m.s.a.TokenCacheConfiguration : Default Guava implementation for token cache is used.
Parameters:

  • max cache size: 10000
  • expire after access: 10 minutes
    2023-10-09 13:39:27.336 INFO 21960 — [ main] o.s.boot.web.servlet.RegistrationBean : Filter preAuthenticateServletFilter was not registered (disabled)
    2023-10-09 13:39:27.337 INFO 21960 — [ main] o.s.boot.web.servlet.RegistrationBean : Filter postAuthenticateServletFilter was not registered (disabled)
    2023-10-09 13:39:28.923 INFO 21960 — [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 4 endpoint(s) beneath base path ‘’
    2023-10-09 13:39:30.536 INFO 21960 — [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@174b8d0e, org.springframework.security.web.header.HeaderWriterFilter@69c1ea07, org.springframework.security.web.authentication.logout.LogoutFilter@3e9b3b3c, com.cumulocity.microservice.security.token.CumulocityOAuthMicroserviceFilter@46ea78f0, com.cumulocity.microservice.security.filter.PreAuthenticateServletFilter@69feb4d9, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@5dce5c03, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@47eae91d, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@112530c3, com.cumulocity.microservice.security.filter.PostAuthenticateServletFilter@37c1cfa, org.springframework.security.web.access.ExceptionTranslationFilter@2fea9a7b, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@71ee2fff]
    2023-10-09 13:39:30.859 INFO 21960 — [ main] c.c.m.s.TenantOptionPropertySource : Overriding application settings with tenant options is enabled.
    2023-10-09 13:39:30.901 WARN 21960 — [ main] .m.s.s.i.MicroserviceSettingsServiceImpl : Loading tenant options using bootstrap credentials!
    2023-10-09 13:39:49.182 WARN 21960 — [ main] c.c.m.context.ContextServiceImpl : execution of task failed within tenant : t54905 - Http status code: 401
    {error=“security/Unauthorized”,message=“Invalid credentials!”,info=“https://cumulocity.com/guides/reference/openapi/”}
    2023-10-09 13:39:49.184 WARN 21960 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘standardJacksonObjectMapperBuilderCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration.class]: Unsatisfied dependency expressed through method ‘standardJacksonObjectMapperBuilderCustomizer’ parameter 1; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name ‘spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties’: Could not bind properties to ‘JacksonProperties’ : prefix=spring.jackson, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under ‘spring.jackson’ to org.springframework.boot.autoconfigure.jackson.JacksonProperties
    2023-10-09 13:39:49.193 INFO 21960 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
    2023-10-09 13:39:49.219 INFO 21960 — [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2023-10-09 13:39:49.239 ERROR 21960 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Failed to bind properties under ‘spring.jackson’ to org.springframework.boot.autoconfigure.jackson.JacksonProperties:

Reason: com.cumulocity.sdk.client.SDKException: Http status code: 401

{error=“security/Unauthorized”,message=“Invalid credentials!”,info=“https://cumulocity.com/guides/reference/openapi/”}

Action:

Update your application’s configuration


Regards/-
PRakash

This is an issue, here the mentioned application should match to the “application.name” property and must be “ogcreatemanagedobjsdkk” in your case (not “servicebootstrap_ogcreatemanagedobjsdkk”)

Do you have another application.properties file which might have an incorrect setup of the “application.name” property?

I fixed this part.

This is an issue, here the mentioned application should match to the “application.name ” property and must be “ogcreatemanagedobjsdkk ” in your case (not “servicebootstrap_ogcreatemanagedobjsdkk ”)

In the folder i have only one project this one.

Do you have another application.properties file which might have an incorrect setup of the “application.name ” property?

Note : Same code base is working very well on another system i meant my colleague system.

Do you still get the same error?

Hello Kai,

Yes, Same error logs.

Below are the logs

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

2023-10-09 19:46:38.884 INFO 21432 — [ main] c.s.g.GenerateManagedObjectsApplication : Starting GenerateManagedObjectsApplication using Java 17.0.8.1 on PCNA-PG035HCQ with PID 21432 (C:\Users\PSinha\OneDrive - Solenis LLC\Desktop\Github\IoT_CreateManagedObjects_Backend\IoT_CreateManagedObjects_Backend\target\classes started by PSinha in C:\Users\PSinha\OneDrive - Solenis LLC\Desktop\Github\IoT_CreateManagedObjects_Backend\IoT_CreateManagedObjects_Backend)
2023-10-09 19:46:38.891 INFO 21432 — [ main] c.s.g.GenerateManagedObjectsApplication : No active profile set, falling back to 1 default profile: “default”
2023-10-09 19:46:42.805 INFO 21432 — [ 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-10-09 19:46:42.873 INFO 21432 — [ 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-10-09 19:46:43.189 INFO 21432 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘com.cumulocity.microservice.security.annotation.UserDetailsServiceConfiguration’ of type [com.cumulocity.microservice.security.annotation.UserDetailsServiceConfiguration$$EnhancerBySpringCGLIB$$d6ad83c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-10-09 19:46:43.260 INFO 21432 — [ 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-10-09 19:46:43.260 INFO 21432 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘applicationApi’ of type [com.cumulocity.microservice.subscription.repository.application.ApplicationApi$$EnhancerBySpringCGLIB$$1adc662b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-10-09 19:46:43.283 INFO 21432 — [ 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-10-09 19:46:43.286 INFO 21432 — [ main] trationDelegate$BeanPostProcessorChecker : Bean ‘com.cumulocity.microservice.security.annotation.EnableGlobalMethodSecurityConfiguration’ of type [com.cumulocity.microservice.security.annotation.EnableGlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$5ad06693] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-10-09 19:46:44.645 INFO 21432 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8082 (http)
2023-10-09 19:46:44.683 INFO 21432 — [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-10-09 19:46:44.684 INFO 21432 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.63]
2023-10-09 19:46:45.335 INFO 21432 — [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-10-09 19:46:45.335 INFO 21432 — [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 6299 ms
2023-10-09 19:46:45.496 INFO 21432 — [ main] bleMicroserviceSubscriptionConfiguration : Microservice repository will be build for application ‘ogcreatemanagedobjsdk1’.
2023-10-09 19:46:46.779 INFO 21432 — [ main] c.c.m.s.a.TokenCacheConfiguration : Default Guava implementation for token cache is used.
Parameters:

  • max cache size: 10000
  • expire after access: 10 minutes
    2023-10-09 19:46:46.864 INFO 21432 — [ main] o.s.boot.web.servlet.RegistrationBean : Filter preAuthenticateServletFilter was not registered (disabled)
    2023-10-09 19:46:46.864 INFO 21432 — [ main] o.s.boot.web.servlet.RegistrationBean : Filter postAuthenticateServletFilter was not registered (disabled)
    2023-10-09 19:46:48.385 INFO 21432 — [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 4 endpoint(s) beneath base path ‘’
    2023-10-09 19:46:49.654 INFO 21432 — [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@355493bf, org.springframework.security.web.header.HeaderWriterFilter@e993715, org.springframework.security.web.authentication.logout.LogoutFilter@4583b617, com.cumulocity.microservice.security.token.CumulocityOAuthMicroserviceFilter@46ea78f0, com.cumulocity.microservice.security.filter.PreAuthenticateServletFilter@69feb4d9, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@63c4d16, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@5cfa2ac5, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@7ebc5be6, com.cumulocity.microservice.security.filter.PostAuthenticateServletFilter@37c1cfa, org.springframework.security.web.access.ExceptionTranslationFilter@5cbe72b9, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@86377d5]
    2023-10-09 19:46:49.909 INFO 21432 — [ main] c.c.m.s.TenantOptionPropertySource : Overriding application settings with tenant options is enabled.
    2023-10-09 19:46:49.937 WARN 21432 — [ main] .m.s.s.i.MicroserviceSettingsServiceImpl : Loading tenant options using bootstrap credentials!
    2023-10-09 19:47:07.972 WARN 21432 — [ main] c.c.m.context.ContextServiceImpl : execution of task failed within tenant : t54905 - Http status code: 401
    {error=“security/Unauthorized”,message=“Invalid credentials!”,info=“https://cumulocity.com/guides/reference/openapi/”}
    2023-10-09 19:47:07.979 WARN 21432 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘standardJacksonObjectMapperBuilderCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration.class]: Unsatisfied dependency expressed through method ‘standardJacksonObjectMapperBuilderCustomizer’ parameter 1; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name ‘spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties’: Could not bind properties to ‘JacksonProperties’ : prefix=spring.jackson, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under ‘spring.jackson’ to org.springframework.boot.autoconfigure.jackson.JacksonProperties
    2023-10-09 19:47:08.010 INFO 21432 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
    2023-10-09 19:47:08.118 INFO 21432 — [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2023-10-09 19:47:08.246 ERROR 21432 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Failed to bind properties under ‘spring.jackson’ to org.springframework.boot.autoconfigure.jackson.JacksonProperties:

Reason: com.cumulocity.sdk.client.SDKException: Http status code: 401

{error=“security/Unauthorized”,message=“Invalid credentials!”,info=“https://cumulocity.com/guides/reference/openapi/”}

Action:

Update your application’s configuration

Hi,
please confirm again that you only have 1 .properties file - as you log shows you are using the default profile.
Still also the logs show another tenant ID than you expect, so you need to fix that.
Additionally now the application name is “ogcreatemanagedobjsdk1” instead of “ogcreatemanagedobjsdkk” (as shown here: Not able to connect microservice from local to tenant - #4 by prakash.veer06)

Hello Kai,

Please find below my comments.

please confirm again that you only have 1 .properties file - as you log shows you are using the default profile.

Yes, I am using the only one properties file i.e default properties

Still also the logs show another tenant ID than you expect, so you need to fix that.

I am also clueless about this . From where it is taking and i have already mentioned in my first query.

Additionally now the application name is “ogcreatemanagedobjsdk1” instead of “ogcreatemanagedobjsdkk”

Changes the application name to “ogcreatemanagedobjsdk1” and created new credentials . I was thinking about the new credential will might solve the problem. but i didn’t work out.

Regards
Prakash

The main problem is the incorrect tenant ID it takes from somewhere else.
If this is not matching the correct tenant ID the credentials will never work.

You could double check that when running via the IDE no arguments are provided which might override the tenant ID (e.g. using “-D C8Y.bootstrap.tenant”).

For a test could you also try to change the “server.port”, e.g. to 8090, to see if the application.properties is loaded correctly?

Thanks

Hello Kai,
Thank a lot for your prompt answering on my post.
But still i am facing same issue.

You could double check that when running via the IDE no arguments are provided which might override the tenant ID (e.g. using “-D C8Y.bootstrap.tenant”).

I am not passing any argument

For a test could you also try to change the “server.port”, e.g. to 8090, to see if the application.properties is loaded correctly?

If i change the port , it is taking the latest on

Please let me know, if i need to take other step to resolve this.

Regards/-
Prakash
9990434396

Hi Prakash,
as it is recommended and best practice anyway I would suggest to actually do not touch the application.properties file,
but create a development profile application-dev.properties and copy all the C8Y..... properties into this file.

Your application.properties should only contain below lines:

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

#Cumulocity configuration for running localy and connecting to cumulocity
application.name=ogcreatemanagedobjsdk

Your application-dev.properties should look like this:

server.port=8082

#cumulocity configuration for running localy and connecting to cumulocity
application.name=ogcreatemanagedobjsdkk
C8Y.bootstrap.register=true
C8Y.bootstrap.tenant={{TenantID}}
C8Y.baseURL={{URL}}
C8Y.bootstrap.user=servicebootstrap_ogcreatemanagedobjsdkk
C8Y.bootstrap.password={{Password}}
C8Y.microservice.isolation=MULTI_TENANT

spring.mvc.pathmatch.matching-strategy=ant_path_matcher
spring.main.allow-circular-references=true

Then you need to tell Spring to use your “dev”-profile either in your IDE directly (STS supports it) or via the VM argument:

 -Dspring.profiles.active=dev

Alternatively you could also add “spring.profiles.active=dev” into your application.properties file, but be aware this needs to be removed prior deployment to Cumulocity, otherwise it will not start up properly once deployed.

Then some of the first log lines should also tell you that it is now running the “dev” profile and not the default profile anymore.

Hello Kai,

I did the same thing as per your instruction but i am getting same error.

application.properties file content

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

application-dev.properties file content

server.port=8090
cumulocity configuration for running localy and connecting to cumulocity
application.name=ogcreatemanagedobjsdk1
C8Y.bootstrap.register=true
C8Y.bootstrap.tenant={tenant_id}
C8Y.baseURL={tenant_URL}
C8Y.bootstrap.user={user_id}
C8Y.bootstrap.password={password}
C8Y.microservice.isolation=MULTI_TENANT
spring.mvc.pathmatch.matching-strategy=ant_path_matcher

spring.main.allow-circular-references=true

Regards/-
Prakash

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.