Caused 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:/home/mosip/mock-identity-system.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.1.0-lib.jar!/io/mosip/kernel/keymanager/hsm/impl/KeyStoreImpl.class]: Invocation of init method failed; nested exception is java.lang.reflect.InvocationTargetException
I am getting this error while deploying mock identity system. I am using the chart mosip/mock-identity-system:0.10.1
Dear @Vijay_S ,
Thank you for reaching out, We’re looking into your query and one of us will respond here with solution inputs.
Best Regards
Team MOSIP
@Vijay_S As part Pre-requisites
is the softhsm-mock-identity-system
deployed under the softhsm
namespace?
Does namespace would be a problem? softhsm is also running in a same namespace as mock-identity-system.
Not a problem, just wanted to check if the softhsm-mock-identity-system
is deployed.
Could you please restart both softhsm-mock-identity-system
and mock-identity-system
, and share the logs for mock-identity-system
?
This the whole error log
{"@timestamp":"2025-04-22T12:48:19.607Z","@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 'appConfig': 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:/home/mosip/mock-identity-system.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.1.0-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:643)\n\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)\n\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)\n\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:315)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)\n\tat io.mosip.esignet.mock.identitysystem.MockIdentitySystemApplication.main(MockIdentitySystemApplication.java:25)\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:49)\n\tat org.springframework.boot.loader.Launcher.launch(Launcher.java:107)\n\tat org.springframework.boot.loader.Launcher.launch(Launcher.java:58)\n\tat org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)\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:/home/mosip/mock-identity-system.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.1.0-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:643)\n\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)\n\t... 28 common frames omitted\nCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'keyStoreImpl' defined in URL [jar:file:/home/mosip/mock-identity-system.jar!/BOOT-INF/lib/kernel-keymanager-service-1.2.1.0-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:1794)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)\n\t... 41 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:1853)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)\n\t... 51 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.<init>(PKCS11KeyStoreImpl.java:141)\n\t... 58 common frames omitted\nCaused by: java.security.ProviderException: Initialization failed\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.<init>(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... 60 common frames omitted\nCaused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_NOT_SUPPORTED\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.wrapper.PKCS11.C_Initialize(Native Method)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.wrapper.PKCS11$SynchronizedPKCS11.C_Initialize(PKCS11.java:1631)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.wrapper.PKCS11.getInstance(PKCS11.java:166)\n\tat jdk.crypto.cryptoki/sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:338)\n\t... 65 common frames omitted\n","appName":"mock-identity-system"}
Hi @Vijay_S
Kindly follow the steps below in the given order
- Truncate the key_alias table in the mock-identity-system DB
- Restart the mock-identity-system softHSM pod
- Restart the mock-identity-system pod
Note: esignet and mock-identity-system use 2 different softHSM
If you still face the same issue, please share the softHSM configuration file and the output of the following command when executed in the softHSM pod:
softhsm2-util --show-slots