Exception while starting Tomcat on port 80 for Docker Container with Cumulocity SDK microservice Java

What product/components do you use and which version/fix level are you on?

Software AG with Cumulocity IoT platform Version 1013.0.167

Is your question related to the free trail, or to a production (customer) instance?

Free Trial
Tenant - dhrushah
Region : US Oregon

What are you trying to achieve? Please describe in detail.

I am evalauating the free trial version for Cumulocity IoT for the customer and we shall be using the same for customer migration in future. As a part of same activity i am trying to explore microservice framework from Cumulocity. Since I am not licensed tenant so deploying the Microservice option is not available for myself so I am trying to Host the service as Docker Container and then link to microservice on cumulocity IoT platform .

When trying to run the docker container for simple Hello World using the documentation mentioned in Microservice Guide

I am getting below error and my tomcat on port 80 doesn’t come up inside the container from the image prepared my Maven . I also tried to clone git project for cumulocity and getting same error mentioned below ,

Do you get any error messages? Please provide a full error message screenshot and log file.

022-08-10 18:49:02.529  INFO 9 --- [main] bleMicroserviceSubscriptionConfiguration : Microservice repository will be build for application 'my-first-microservice'.
2022-08-10 18:49:03.051  WARN 9 --- [main] .m.s.s.i.MicroserviceSettingsServiceImpl : Loading tenant options using bootstrap credentials!
2022-08-10 18:49:18.891  WARN 9 --- [main] c.c.m.context.ContextServiceImpl         : execution of task failed within tenant : dhrushah - java.lang.IllegalArgumentException: Host name may not be null
202**2-08-10 18:49:18.894 ERROR 9 --- [main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'cumulocityOAuthMicroserviceFilter': Unsatisfied dependency expressed through method 'setAuthenticationManager' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.cumulocity.microservice.security.annotation.EnableWebSecurityConfiguration': Unsatisfied dependency expressed through field 'jwtTokenAuthenticationProvider'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtTokenAuthenticationProvider' defined in URL [jar:file:/data/hello-microservice-java.jar!/BOOT-INF/lib/microservice-security-1013.0.167.jar!/com/cumulocity/microservice/security/token/JwtTokenAuthenticationProvider.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAuthenticatedTokenCache' defined in com.cumulocity.microservice.security.annotation.TokenCacheConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.security.token.JwtAuthenticatedTokenCache]: Factory method 'jwtAuthenticatedTokenCache' threw exception; nested exception is com.google.common.util.concurrent.UncheckedExecutionException: javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: Host name may not be null**
**2022-08-10 18:49:18.913  INFO 9 --- [main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]**
**2022-08-10 18:49:18.920  WARN 9 --- [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**
2022-08-10 18:49:18.933  INFO 9 --- [main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-08-10 18:49:18.955 ERROR 9 --- [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:163)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:448)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
        at c8y.example.App.main(App.java:13)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142)
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104)
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:455)
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:204)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160)
        ... 16 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cumulocityOAuthMicroserviceFilter': Unsatisfied dependency expressed through method 'setAuthenticationManager' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.cumulocity.microservice.security.annotation.EnableWebSecurityConfiguration': Unsatisfied dependency expressed through field 'jwtTokenAuthenticationProvider'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtTokenAuthenticationProvider' defined in URL [jar:file:/data/hello-microservice-java.jar!/BOOT-INF/lib/microservice-security-1013.0.167.jar!/com/cumulocity/microservice/security/token/JwtTokenAuthenticationProvider.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAuthenticatedTokenCache' defined in com.cumulocity.microservice.security.annotation.TokenCacheConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.security.token.JwtAuthenticatedTokenCache]: Factory method 'jwtAuthenticatedTokenCache' threw exception; nested exception is com.google.common.util.concurrent.UncheckedExecutionException: javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: Host name may not be null
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:767)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:719)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:212)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:175)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:170)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:155)
        at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:87)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:260)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:234)
        at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5219)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123)
        ... 21 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.cumulocity.microservice.security.annotation.EnableWebSecurityConfiguration': Unsatisfied dependency expressed through field 'jwtTokenAuthenticationProvider'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtTokenAuthenticationProvider' defined in URL [jar:file:/data/hello-microservice-java.jar!/BOOT-INF/lib/microservice-security-1013.0.167.jar!/com/cumulocity/microservice/security/token/JwtTokenAuthenticationProvider.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAuthenticatedTokenCache' defined in com.cumulocity.microservice.security.annotation.TokenCacheConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.security.token.JwtAuthenticatedTokenCache]: Factory method 'jwtAuthenticatedTokenCache' threw exception; nested exception is com.google.common.util.concurrent.UncheckedExecutionException: javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: Host name may not be null
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:410)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:759)
        ... 63 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtTokenAuthenticationProvider' defined in URL [jar:file:/data/hello-microservice-java.jar!/BOOT-INF/lib/microservice-security-1013.0.167.jar!/com/cumulocity/microservice/security/token/JwtTokenAuthenticationProvider.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAuthenticatedTokenCache' defined in com.cumulocity.microservice.security.annotation.TokenCacheConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.security.token.JwtAuthenticatedTokenCache]: Factory method 'jwtAuthenticatedTokenCache' threw exception; nested exception is com.google.common.util.concurrent.UncheckedExecutionException: javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: Host name may not be null
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
        ... 86 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAuthenticatedTokenCache' defined in com.cumulocity.microservice.security.annotation.TokenCacheConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.security.token.JwtAuthenticatedTokenCache]: Factory method 'jwtAuthenticatedTokenCache' threw exception; nested exception is com.google.common.util.concurrent.UncheckedExecutionException: javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: Host name may not be null
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        ... 99 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cumulocity.microservice.security.token.JwtAuthenticatedTokenCache]: Factory method 'jwtAuthenticatedTokenCache' threw exception; nested exception is com.google.common.util.concurrent.UncheckedExecutionException: javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: Host name may not be null
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 113 common frames omitted
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: Host name may not be null
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2055)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3966)
        at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4863)
        at com.cumulocity.microservice.settings.service.impl.MicroserviceSettingsServiceImpl.getAll(MicroserviceSettingsServiceImpl.java:39)
        at com.cumulocity.microservice.settings.service.impl.MicroserviceSettingsServiceImpl.get(MicroserviceSettingsServiceImpl.java:83)
        at com.cumulocity.microservice.security.annotation.TokenCacheConfiguration.lambda$jwtAuthenticatedTokenCache$0(TokenCacheConfiguration.java:36)
        at java.base/java.util.Optional.map(Optional.java:258)
        at com.cumulocity.microservice.security.annotation.TokenCacheConfiguration.jwtAuthenticatedTokenCache(TokenCacheConfiguration.java:36)
        at com.cumulocity.microservice.security.annotation.TokenCacheConfiguration$$EnhancerBySpringCGLIB$$16a9220b.CGLIB$jwtAuthenticatedTokenCache$0(<generated>)
        at com.cumulocity.microservice.security.annotation.TokenCacheConfiguration$$EnhancerBySpringCGLIB$$16a9220b$$FastClassBySpringCGLIB$$f4141950.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at com.cumulocity.microservice.security.annotation.TokenCacheConfiguration$$EnhancerBySpringCGLIB$$16a9220b.jwtAuthenticatedTokenCache(<generated>)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 114 common frames omitted
Caused by: javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: Host name may not be null
        at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:531)
        at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:297)
        at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$0(JerseyInvocation.java:662)
        at org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:697)
        at org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:691)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
        at org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:691)
        at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:661)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:413)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:313)
        at com.cumulocity.sdk.client.RestConnector.getClientResponse(RestConnector.java:136)
        at com.cumulocity.sdk.client.RestConnector.get(RestConnector.java:115)
        at com.cumulocity.sdk.client.RestConnector$$FastClassBySpringCGLIB$$37cf0cc3.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
        at com.cumulocity.sdk.client.RestConnector$$EnhancerBySpringCGLIB$$74b40453.get(<generated>)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi.lambda$findAll$0(CurrentApplicationSettingsApi.java:27)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi$SettingsRetry.execute(CurrentApplicationSettingsApi.java:85)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi$SettingsRetry.executeWithRetry(CurrentApplicationSettingsApi.java:61)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi$SettingsRetry.executeWithWait(CurrentApplicationSettingsApi.java:80)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi$SettingsRetry.executeWithRetry(CurrentApplicationSettingsApi.java:64)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi$SettingsRetry.executeWithWait(CurrentApplicationSettingsApi.java:80)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi$SettingsRetry.executeWithRetry(CurrentApplicationSettingsApi.java:64)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi.findAll(CurrentApplicationSettingsApi.java:26)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi$$FastClassBySpringCGLIB$$4dc87c3.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
        at com.cumulocity.microservice.settings.repository.CurrentApplicationSettingsApi$$EnhancerBySpringCGLIB$$78ee3f53.findAll(<generated>)
        at com.cumulocity.microservice.settings.service.impl.MicroserviceSettingsServiceImpl$1$1.call(MicroserviceSettingsServiceImpl.java:47)
        at com.cumulocity.microservice.settings.service.impl.MicroserviceSettingsServiceImpl$1$1.call(MicroserviceSettingsServiceImpl.java:45)
        at com.cumulocity.microservice.context.ContextServiceImpl.callWithinContext(ContextServiceImpl.java:78)
        at com.cumulocity.microservice.settings.service.impl.MicroserviceSettingsServiceImpl$1.call(MicroserviceSettingsServiceImpl.java:45)
        at com.cumulocity.microservice.settings.service.impl.MicroserviceSettingsServiceImpl$1.call(MicroserviceSettingsServiceImpl.java:39)
        at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4868)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3533)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2282)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2159)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049)
        ... 131 common frames omitted
Caused by: java.lang.IllegalArgumentException: Host name may not be null
        at org.apache.http.util.Args.containsNoBlanks(Args.java:81)
        at org.apache.http.HttpHost.<init>(HttpHost.java:80)
        at org.glassfish.jersey.apache.connector.ApacheConnector.getHost(ApacheConnector.java:564)
        at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:483)
        ... 185 common frames omitted

Since this is cumulocity spefic exception so i am not able to get more on google articles as well as forums .Please help as i am blocked and cannot explore more to use cumulocity as for my customer or not ?

Have you installed all the latest fixes of the products and systems you are using?

Yes latest patches are installed and using latest maven plugin as per guide

Please help here so that I can be ensured of support channel and getting the quick fixes for the solution as well

Thanks
Dhruv Shah

Hi Dhruv Shah,

Edit: Previous statement was not entirely correct. Microservices can be run outside of the platform without the microservice-feature being enabled.

As mentioned in the documentation the microservices feature is required when you want to upload the microservice.
You can contact product support in this case to get this enabled for your tenant.

Generally when running the microservice outside of Cumulocity you need to ensure to pass all required parameters as environment variables into the container,
as it is explained here Running the microservice locally.

Regards Kai

Hi Kai ,

Thanks for the response. I think we are mixing 2 things here , I can understand that Micro service feature is for licensed tenant only and I know i will be soon migrating to the same but cumulocity provides a way to host the micro service as docker container locally which would help to achieve same functionality and I have followed all same steps as mentioned in below link Running the micro service locally > Run the Docker container

I also have the bootstrap micro service user available for the application I created on cumulocity show below ,

//Boot Strap User Credentials

{
“password”: “yUo8K90nNWhTlG97S3QmJKmW3DJrT422”,
“name”: “servicebootstrap_my-first-application”,
“tenant”: “dhrushah”
}

I think after this all should work fine with same parameters and command passed to the docker shown below ,
docker run -p 8082:80 -e C8Y_BOOTSTRAP_TENANT=dhrushah
-e C8Y_BOOTSTRAP_USER=servicebootstrap_my-first-application
-e C8Y_BOOTSTRAP_PASSWORD=yUo8K90nNWhTlG97S3QmJKmW3DJrT422
-e C8Y_MICROSERVICE_ISOLATION=MULTI_TENANT
-i -t -e C8Y_BASEURL= f9ccbcb251b5

Also don’t think bootstrap user is the issue here as the exception points to some internal class from cumulocity platform throwing exception due to host name been null not sure if that is related to user …

Also as per below mentioned line ,
However therefor you need the micro service bootstrap user, for which you require the previously mentioned microservice-feature.

Are you saying that even for running Micro service locally as docker container we need to have Micro service feature enabled for tenant ? Ideally as per documentation it is only needed if we upload the zip file as Micro-service on cumulocity IoT platform

Awaiting response as I am blocked to proceed on my producer API

Thanks
Dhruv Shah

Hi Dhruv Shah,

your C8Y_BASEURL parameter looks kind of strange. It should actually be the URL to your Cumulocity instance, e.g. https://my-tenant.eu-latest.cumulocity.com.

The error also indicates that something is wrong with the URL you provide:

2022-08-10 18:49:18.891  WARN 9 --- [main] c.c.m.context.ContextServiceImpl         : execution of task failed within tenant : dhrushah - java.lang.IllegalArgumentException: Host name may not be null

Best regards
Christian

1 Like

Hi Christian,

I did supplied the domain to C8Y_BASEURL but this forum doesn’t allow to post the links in the reply or comments that’s why removed from command , actually figured out the issue anyhow i was missing https from the C8Y_BASEURL in the FQDN URL and instead passing only domain URL that’s why it was taking this as NULL.

@Kai_Sieben Also the tenant name was fine , as for trail account we are given name as dhrushah as tenant id only may be for licensed it is t

After adding https to the C8Y_BASEURL i was able to run docker container successfully

Thanks @Kai_Sieben and @Christian_Guether1 for all the help !

Cheers

1 Like

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