Can’t run Job-batch Keymanager - ERROR (MOSIP version 1.2.0.1-B1)

I have an error Job batch of keymanager:

Error creating bean with name ‘keysGeneratorApplication’: Unsatisfied dependency expressed through field ‘keysGenerator’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘keysGenerator’: Unsatisfied dependency expressed through field ‘keymanagerService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘keymanagerServiceImpl’: Unsatisfied dependency expressed through field ‘keyStore’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘keyStoreImpl’ defined in URL [jar:file:/keys-generator.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.0.1-B1-lib.jar!/io/mosip/kernel/keymanager/hsm/impl/KeyStoreImpl.class]: Invocation of init method failed; nested exception is java.lang.reflect.InvocationTargetException",“logger_name”:“org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext”,“thread_name”:“main”,“level”:“WARN”,“level_value”:30000,“appName”:“keys-generator”}
{“@timestamp”:“2023-03-16T08:52:31.822Z”,“@version”:“1”,“message”:“Closing JPA EntityManagerFactory for persistence unit ‘hibernate’”,“logger_name”:“org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean”,“thread_name”:“main”,“level”:“INFO”,“level_value”:20000,“appName”:“keys-generator”}
{“@timestamp”:“2023-03-16T08:52:31.823Z”,“@version”:“1”,“message”:“HikariPool-1 - Shutdown initiated…”,“logger_name”:“com.zaxxer.hikari.HikariDataSource”,“thread_name”:“main”,“level”:“INFO”,“level_value”:20000,“appName”:“keys-generator”}
{“@timestamp”:“2023-03-16T08:52:31.826Z”,“@version”:“1”,“message”:“HikariPool-1 - Shutdown completed.”,“logger_name”:“com.zaxxer.hikari.HikariDataSource”,“thread_name”:“main”,“level”:“INFO”,“level_value”:20000,“appName”:“keys-generator”}
{“@timestamp”:“2023-03-16T08:52:31.827Z”,“@version”:“1”,“message”:“Stopping service [Tomcat]”,“logger_name”:“org.apache.catalina.core.StandardService”,“thread_name”:“main”,“level”:“INFO”,“level_value”:20000,“appName”:“keys-generator”}
{“@timestamp”:“2023-03-16T08:52:31.834Z”,“@version”:“1”,“message”:“Failed to clear soft references from ObjectStreamClass$Caches for web application [ROOT]”,“logger_name”:“org.apache.catalina.loader.WebappClassLoaderBase”,“thread_name”:“localhost-startStop-1”,“level”:“WARN”,“level_value”:30000,“stack_trace”:“java.lang.ClassCastException: class java.io.ObjectStreamClass$Caches$1 cannot be cast to class java.util.Map (java.io.ObjectStreamClass$Caches$1 and java.util.Map are in module java.base of loader ‘bootstrap’)\n\tat org.apache.catalina.loader.WebappClassLoaderBase.clearCache(WebappClassLoaderBase.java:2193)\n\tat org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesObjectStreamClassCaches(WebappClassLoaderBase.java:2180)\n\tat org.apache.catalina.loader.WebappClassLoaderBase.clearReferences(WebappClassLoaderBase.java:1555)\n\tat org.apache.catalina.loader.WebappClassLoaderBase.stop(WebappClassLoaderBase.java:1500)\n\tat org.apache.catalina.loader.WebappLoader.stopInternal(WebappLoader.java:447)\n\tat org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)\n\tat org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5514)\n\tat org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)\n\tat org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1437)\n\tat org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1426)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:829)\n”,“appName”:“keys-generator”}
{“@timestamp”:“2023-03-16T08:52:31.864Z”,“@version”:“1”,“message”:“\n\nError starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.”,“logger_name”:“org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener”,“thread_name”:“main”,“level”:“INFO”,“level_value”:20000,“appName”:“keys-generator”}
{“@timestamp”:“2023-03-16T08:52:31.873Z”,“@version”:“1”,“message”:“Application run failed”,“logger_name”:“org.springframework.boot.SpringApplication”,“thread_name”:“main”,“level”:“ERROR”,“level_value”:40000,“stack_trace”:“org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘keysGeneratorApplication’: Unsatisfied dependency expressed through field ‘keysGenerator’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘keysGenerator’: Unsatisfied dependency expressed through field ‘keymanagerService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘keymanagerServiceImpl’: Unsatisfied dependency expressed through field ‘keyStore’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘keyStoreImpl’ defined in URL [jar:file:/keys-generator.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.0.1-B1-lib.jar!/io/mosip/kernel/keymanager/hsm/impl/KeyStoreImpl.class]: Invocation of init method failed; nested exception is java.lang.reflect.InvocationTargetException\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)\n\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1348)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)\n\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)\n\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:327)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)\n\tat io.mosip.kernel.keygenerator.KeysGeneratorApplication.main(KeysGeneratorApplication.java:23)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)\n\tat org.springframework.boot.loader.Launcher.launch(Launcher.java:87)\n\tat org.springframework.boot.loader.Launcher.launch(Launcher.java:50)\n\tat org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:593)\nCaused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘keysGenerator’: Unsatisfied dependency expressed through field ‘keymanagerService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘keymanagerServiceImpl’: Unsatisfied dependency expressed through field ‘keyStore’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘keyStoreImpl’ defined in URL [jar:file:/keys-generator.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.0.1-B1-lib.jar!/io/mosip/kernel/keymanager/hsm/impl/KeyStoreImpl.class]: Invocation of init method failed; nested exception is java.lang.reflect.InvocationTargetException\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)\n\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1348)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)\n\t… 27 common frames omitted\nCaused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘keymanagerServiceImpl’: Unsatisfied dependency expressed through field ‘keyStore’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘keyStoreImpl’ defined in URL [jar:file:/keys-generator.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.0.1-B1-lib.jar!/io/mosip/kernel/keymanager/hsm/impl/KeyStoreImpl.class]: Invocation of init method failed; nested exception is java.lang.reflect.InvocationTargetException\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)\n\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1348)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)\n\t… 40 common frames omitted\nCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘keyStoreImpl’ defined in URL [jar:file:/keys-generator.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.0.1-B1-lib.jar!/io/mosip/kernel/keymanager/hsm/impl/KeyStoreImpl.class]: Invocation of init method failed; nested exception is java.lang.reflect.InvocationTargetException\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)\n\t… 53 common frames omitted\nCaused by: java.lang.reflect.InvocationTargetException: null\n\tat java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n\tat java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)\n\tat io.mosip.kernel.keymanager.hsm.impl.KeyStoreImpl.afterPropertiesSet(KeyStoreImpl.java:156)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1765)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702)\n\t… 63 common frames omitted\nCaused by: io.mosip.kernel.core.keymanager.exception.NoSuchSecurityProviderException: KER-KMA-001 → Config file invalid; \nnested exception is java.security.ProviderException: Initialization failed\n\tat io.mosip.kernel.keymanager.hsm.impl.pkcs.PKCS11KeyStoreImpl.setupProvider(PKCS11KeyStoreImpl.java:176)\n\tat io.mosip.kernel.keymanager.hsm.impl.pkcs.PKCS11KeyStoreImpl.initKeystore(PKCS11KeyStoreImpl.java:147)\n\tat io.mosip.kernel.keymanager.hsm.impl.pkcs.PKCS11KeyStoreImpl.(PKCS11KeyStoreImpl.java:141)\n\t… 70 common frames omitted\nCaused by: java.security.ProviderException: Initialization failed\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.(SunPKCS11.java:384)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11$1.run(SunPKCS11.java:115)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11$1.run(SunPKCS11.java:112)\n\tat java.base/java.security.AccessController.doPrivileged(Native Method)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.configure(SunPKCS11.java:112)\n\tat io.mosip.kernel.keymanager.hsm.impl.pkcs.PKCS11KeyStoreImpl.setupProvider(PKCS11KeyStoreImpl.java:173)\n\t… 72 common frames omitted\nCaused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_GENERAL_ERROR\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.wrapper.PKCS11.C_GetTokenInfo(Native Method)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.Token.(Token.java:135)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.initToken(SunPKCS11.java:1031)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.(SunPKCS11.java:375)\n\t… 77 common frames omitted\n”,“appName”:“keys-generator”}

Looks like same problem as your other post. there is something wrong with the softhsm or its not working

Hi @gsasikumar
In pods Softhsm i execute this command

And the Softhsm is working

The softhsm has not been initialized. That does not look correct.

@mahammedtaheer @ckm007 can you please check this.

When executing keymanager deployment we have this error

Hi slimab,

During the installation of HSM client in the container, the install.sh file will be executed with root privilege for the container user. The privilege will be automatically revoked after successful installation. The client.zip file contains softhsm client proxy .so file which will be copied in the directory created.

Are you pulling the docker from mosip docker repository or building the docker with some customization?

MOSIP build dockers will take of the root privilege during the execution of install.sh file automatically. Please recheck any step is missed during the setup.

Thanks

Hello mahammedtaheer,
the problem was fixed and we passed to another error which is opened in KeyManager service error: pkcs11.wrapper.PKCS11Exception: CKR_GENERAL_ERROR - #11 by slimab

thank you

Hi Slimab,

Great, could you please share the solution like what exactly been done to fix the issue.

Hello @mahammedtaheer
We add a local proxy configuration in deployment Keymanager
Exemple:

1 Like