Unable to run pre-registration module

Hello MOSIP Team, To start with doing setup of MOSIP implementation, we are trying to run pre-registration module on our local machine. UI service looks like working fine. But we are facing some issue while set up back-end part.

  1. We have configured and run config-server by using kernel-config-server.jar and cloned mosip-config repo. Then configured bootstrap.properties files. In pre-registrationmodule, the pre-registration-core service is not able to boot-up locally.Its giving Error creating bean with name ‘requestValidator’. please reffer below error and SS for more details. please suggest.

2024-04-16 19:59:49,280 [main] INFO [i.m.k.a.d.c.RestTemplatePostProcessor].postProcessAfterInitialization.46 : Post processing REST_TEMPLATE bean : selfTokenRestTemplate

2024-04-16 19:59:49,376 [main] WARN [o.s.c.s.AbstractApplicationContext].refresh.558 : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘requestValidator’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘java.util.Map<java.lang.String, java.lang.String>’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=“”, name=“”, description=“”, authenticationType=CONTAINER, type=java.lang.Object.class, mappedName=“”)}

2024-04-16 19:59:49,377 [main] INFO [o.s.o.j.AbstractEntityManagerFactoryBean].destroy.597 : Closing JPA EntityManagerFactory for persistence unit ‘hibernate’

2024-04-16 19:59:49,378 [main] INFO [c.z.h.HikariDataSource].close.381 : HikariPool-1 - Shutdown initiated…

2024-04-16 19:59:49,381 [main] INFO [c.z.h.HikariDataSource].close.383 : HikariPool-1 - Shutdown completed.

2024-04-16 19:59:49,384 [main] INFO [o.a.j.l.DirectJDKLog].log.173 : Stopping service [Tomcat]

2024-04-16 19:59:49,389 [localhost-startStop-1] WARN [o.a.j.l.DirectJDKLog].log.175 : Failed to clear soft references from ObjectStreamClass$Caches for web application [ROOT]

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’)

at org.apache.catalina.loader.WebappClassLoaderBase.clearCache(WebappClassLoaderBase.java:2244)

at org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesObjectStreamClassCaches(WebappClassLoaderBase.java:2231)

at org.apache.catalina.loader.WebappClassLoaderBase.clearReferences(WebappClassLoaderBase.java:1603)

at org.apache.catalina.loader.WebappClassLoaderBase.stop(WebappClassLoaderBase.java:1548)

at org.apache.catalina.loader.WebappLoader.stopInternal(WebappLoader.java:452)

at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5437)

at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1428)

at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1417)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:829)

2024-04-16 19:59:49,409 [main] INFO [o.s.b.a.l.ConditionEvaluationReportLoggingListener].logAutoConfigurationReport.101 :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.

2024-04-16 19:59:49,540 [main] ERROR [o.s.b.d.LoggingFailureAnalysisReporter].report.42 :


APPLICATION FAILED TO START


Description:

A component required a bean of type ‘java.lang.String’ that could not be found.

Action:

Consider defining a bean of type ‘java.lang.String’ in your configuration.

2024-04-16 19:59:49,541 [main] ERROR [o.s.b.d.LoggingFailureAnalysisReporter].report.42 :


APPLICATION FAILED TO START


Description:

A component required a bean of type ‘java.lang.String’ that could not be found.

Action:

Consider defining a bean of type ‘java.lang.String’ in your configuration.

  1. And when i am trying to run other services like pre-registration-application-service,pre-registration-batchjob , my laptop getting stuck and after some time process will terminate Eclipse IDE. So is there any specific system and Hardware configuration required?

Note FYI:sWe are following official documentation which is on Pre-registration Developers Guide | MOSIP Docs 1.2.0 and we cloned the repo from release-1.2.0.1 branch, suggested as per the documentation. We appreciate your prompt response.

Thanks
Ganesh Nawle.

1 Like

Hello @all,

Any Update on this? We appreciate your prompt response.

Thanks
Ganesh Nawle

Hi @ganesh_nawle

Apologies for the delayed response from our end one of our team members will look into this today and get back to you about what exact issue you are facing with the backend.

@mayuradesh can you please look into the same and guide him based on the above response?

Best Regards,
Team MOSIP

Hi @ganesh_nawle ,

pre-registration-core is not a spring service and hence we cannot run pre-reg core.
Please start with running pre-registration-application-service inititally as it is the main service post that u can try running other pre-reg services.

Thanks,
Aiham
Team MOSIP

Hi @aihamh ,

Thanks for your response.

  1. As you mentioned above like pre-registration-core is not an spring service, but I can see in pre-registration-core module having “PreRegistartionCoreApplication” class which contains main method and it is anoted with @SpringBootApplication. Then I think it should run as spring-boot Project. Correct me if I am wrong.

  2. When I am trying to run “pre-registration-application-service” it is running partially but at the end it’s giving some which is regrading to “error connecting to auth service”. I thinks it is not able to fetch token and it might be related to key-cloak IAM. Is there any configuration guide we need to follow for key-cloak setup or if you have any setup details. So that we can follow. Same issue is coming for pre-registration-batchjob service. I am attaching error logs and screenshot for same.

{“@timestamp”:“2024-04-24T18:34:24.120+05:30”,“@version”:“1”,“message”:“Fetched the identity json from config server{\r\n\t"identity": {\r\n\t\t"IDSchemaVersion": {\r\n\t\t\t"value": "IDSchemaVersion"\r\n\t\t},\r\n\t\t"name": {\r\n\t\t\t"value": "fullName"\r\n\t\t},\r\n\t\t"gender": {\r\n\t\t\t"value": "gender"\r\n\t\t},\r\n\t\t"dob": {\r\n\t\t\t"value": "dateOfBirth"\r\n\t\t},\r\n\t\t"age": {\r\n\t\t\t"value": "age"\r\n\t\t},\r\n\t\t"introducerRID": {\r\n\t\t\t"value": "introducerRID"\r\n\t\t},\r\n\t\t"introducerUIN": {\r\n\t\t\t"value": "introducerUIN"\r\n\t\t},\r\n\t\t"introducerVID": {\r\n\t\t\t"value": "introducerVID"\r\n\t\t},\r\n\t\t"introducerName": {\r\n\t\t\t"value": "introducerName"\r\n\t\t},\r\n\t\t"phone": {\r\n\t\t\t"value": "phone"\r\n\t\t},\r\n\t\t"phoneNumber": {\r\n\t\t\t"value": "phone"\r\n\t\t},\r\n\t\t"email": {\r\n\t\t\t"value": "email"\r\n\t\t},\r\n\t\t"emailId": {\r\n\t\t\t"value": "email"\r\n\t\t},\r\n\t\t"uin": {\r\n\t\t\t"value": "UIN"\r\n\t\t},\r\n\t\t"vid": {\r\n\t\t\t"value": "VID"\r\n\t\t},\r\n\t\t"individualBiometrics": {\r\n\t\t\t"value": "individualBiometrics"\r\n\t\t},\r\n\t\t"introducerBiometrics": {\r\n\t\t\t"value": "introducerBiometrics"\r\n\t\t},\r\n\t\t"individualAuthBiometrics": {\r\n\t\t\t"value": "individualAuthBiometrics"\r\n\t\t},\r\n\t\t"officerBiometricFileName": {\r\n\t\t\t"value": "officerBiometricFileName"\r\n\t\t},\r\n\t\t"supervisorBiometricFileName": {\r\n\t\t\t"value": "supervisorBiometricFileName"\r\n\t\t},\r\n\t\t"residenceStatus": {\r\n\t\t\t"value": "residenceStatus"\r\n\t\t},\r\n\t\t"preferredLanguage": {\r\n\t\t\t"value": "preferredLang"\r\n\t\t},\r\n\t\t"locationHierarchyForProfiling": {\r\n\t\t\t"value": "zone,postalCode"\r\n\t\t},\r\n\t\t"addressLine1": {\r\n\t\t\t"value": "addressLine1"\r\n\t\t},\r\n\t\t"addressLine2": {\r\n\t\t\t"value": "addressLine2"\r\n\t\t},\r\n\t\t"addressLine3": {\r\n\t\t\t"value": "addressLine3"\r\n\t\t},\r\n\t\t"location1": {\r\n\t\t\t"value": "city"\r\n\t\t},\r\n\t\t"location2": {\r\n\t\t\t"value": "region"\r\n\t\t},\r\n\t\t"location3": {\r\n\t\t\t"value": "province"\r\n\t\t},\r\n\t\t"postalCode": {\r\n\t\t\t"value": "postalCode"\r\n\t\t},\r\n\t\t"location4": {\r\n\t\t\t"value": "zone"\r\n\t\t},\r\n\t\t"fullAddress": {\r\n\t\t\t"value": "addressLine1,addressLine2,addressLine3,city,region,province,postalCode"\r\n\t\t},\r\n\t\t"bestTwoFingers": {\r\n\t\t\t"value": "bestTwoFingers"\r\n\t\t},\r\n\t\t"birthdate": {\r\n\t\t\t"value": "dateOfBirth"\r\n\t\t},\r\n\t\t"picture": {\r\n\t\t\t"value": "face"\r\n\t\t},\r\n\t\t"phone_number": {\r\n\t\t\t"value": "phone"\r\n\t\t},\r\n\t\t"address": {\r\n\t\t\t"value": "addressLine1,addressLine2,addressLine3,city,region,province,postalCode"\r\n\t\t},\r\n\r\n\t\t"individual_id": {\r\n\t\t\t"value": "individual_id"\r\n\t\t},\r\n\t\t"street_address": {\r\n\t\t\t"value": "addressLine1,addressLine2,addressLine3"\r\n\t\t},\r\n\t\t"locality": {\r\n\t\t\t"value": "city"\r\n\t\t},\r\n\t\t"region": {\r\n\t\t\t"value": "region"\r\n\t\t},\r\n\t\t"postal_code": {\r\n\t\t\t"value": "postalCode"\r\n\t\t},\r\n\t\t"country": {\r\n\t\t\t"value": "province"\r\n\t\t}\r\n\t},\r\n\t"metaInfo": {\r\n\t\t"value": "metaInfo"\r\n\t},\r\n\t"audits": {\r\n\t\t"value": "audits"\r\n\t},\r\n\t"documents": {\r\n\t\t"poa": {\r\n\t\t\t"value": "proofOfAddress"\r\n\t\t},\r\n\t\t"poi": {\r\n\t\t\t"value": "proofOfIdentity"\r\n\t\t},\r\n\t\t"por": {\r\n\t\t\t"value": "proofOfRelationship"\r\n\t\t},\r\n\t\t"pob": {\r\n\t\t\t"value": "proofOfDateOfBirth"\r\n\t\t},\r\n\t\t"poe": {\r\n\t\t\t"value": "proofOfException"\r\n\t\t}\r\n\t},\r\n\t"attributeUpdateCountLimit": {\r\n\t\t"fullName": 2,\r\n\t\t"gender": 1,\r\n\t\t"dob": 1,\r\n\t\t"age": 1\r\n\t}\r\n}\r\n”,“logger_name”:“io.mosip.preregistration.application.service.DemographicService”,“thread_name”:“restartedMain”,“level”:“INFO”,“level_value”:20000,“appName”:“pre-registration-application-service”}

{“@timestamp”:“2024-04-24T18:34:24.121+05:30”,“@version”:“1”,“message”:“sessionId - idType - id - In applicationStartedEvent method of ApplicationEventListerner demographic Service setup() method is called”,“logger_name”:“io.mosip.preregistration.application.config.ApplicationEventListerner”,“thread_name”:“restartedMain”,“level”:“INFO”,“level_value”:20000,“appName”:“pre-registration-application-service”}

{“@timestamp”:“2024-04-24T18:34:24.182+05:30”,“@version”:“1”,“message”:"getAllDocCategoriesAndTypes url: http://masterdata.kernel/v1/masterdata/validdocuments/all?pageSize=50 ",“logger_name”:“io.mosip.preregistration.core.util.ValidationUtil”,“thread_name”:“restartedMain”,“level”:“INFO”,“level_value”:20000,“appName”:“pre-registration-application-service”}

{“@timestamp”:“2024-04-24T18:34:24.304+05:30”,“@version”:“1”,“message”:“Requesting for new Token for the provided OIDC Service: http://localhost:8080/auth/realms/",“logger_name”:“io.mosip.kernel.auth.defaultadapter.helper.TokenHelper”,“thread_name”:“restartedMain”,“level”:“INFO”,“level_value”:20000,“appName”:“pre-registration-application-service”,“traceId”:“cdd2a5db9c0339fd”,“spanId”:“cdd2a5db9c0339fd”,“spanExportable”:“false”,“X-Span-Export”:“false”,“X-B3-SpanId”:“cdd2a5db9c0339fd”,“X-B3-TraceId”:"cdd2a5db9c0339fd”}

{“@timestamp”:“2024-04-24T18:34:24.358+05:30”,“@version”:“1”,“message”:“error connecting to auth service {"error":"Unable to find matching target resource method"}”,“logger_name”:“io.mosip.kernel.auth.defaultadapter.helper.TokenHelper”,“thread_name”:“restartedMain”,“level”:“ERROR”,“level_value”:40000,“appName”:“pre-registration-application-service”,“traceId”:“cdd2a5db9c0339fd”,“spanId”:“cdd2a5db9c0339fd”,“spanExportable”:“false”,“X-Span-Export”:“false”,“X-B3-SpanId”:“cdd2a5db9c0339fd”,“X-B3-TraceId”:“cdd2a5db9c0339fd”}

{“@timestamp”:“2024-04-24T18:34:24.358+05:30”,“@version”:“1”,“message”:“error connecting to auth service Problem in connecting to auth service”,“logger_name”:“io.mosip.kernel.auth.defaultadapter.helper.TokenHelper”,“thread_name”:“restartedMain”,“level”:“ERROR”,“level_value”:40000,“appName”:“pre-registration-application-service”,“traceId”:“cdd2a5db9c0339fd”,“spanId”:“cdd2a5db9c0339fd”,“spanExportable”:“false”,“X-Span-Export”:“false”,“X-B3-SpanId”:“cdd2a5db9c0339fd”,“X-B3-TraceId”:“cdd2a5db9c0339fd”}

{“@timestamp”:“2024-04-24T18:34:24.359+05:30”,“@version”:“1”,“message”:“there is some issue with getting token with clienid and secret”,“logger_name”:“io.mosip.kernel.auth.defaultadapter.config.SelfTokenRestInterceptor”,“thread_name”:“restartedMain”,“level”:“ERROR”,“level_value”:40000,“appName”:“pre-registration-application-service”,“traceId”:“cdd2a5db9c0339fd”,“spanId”:“cdd2a5db9c0339fd”,“spanExportable”:“false”,“X-Span-Export”:“false”,“X-B3-SpanId”:“cdd2a5db9c0339fd”,“X-B3-TraceId”:“cdd2a5db9c0339fd”}

{“@timestamp”:“2024-04-24T18:34:24.385+05:30”,“@version”:“1”,“message”:“\r\n\r\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”:“restartedMain”,“level”:“INFO”,“level_value”:20000,“appName”:“pre-registration-application-service”}

{“@timestamp”:“2024-04-24T18:34:24.400+05:30”,“@version”:“1”,“message”:“Application run failed”,“logger_name”:“org.springframework.boot.SpringApplication”,“thread_name”:“restartedMain”,“level”:“ERROR”,“level_value”:40000,“stack_trace”:“io.mosip.kernel.auth.defaultadapter.exception.AuthAdapterException: Self cached auth token is null\r\n\tat io.mosip.kernel.auth.defaultadapter.config.SelfTokenRestInterceptor.intercept(SelfTokenRestInterceptor.java:71)\r\n\tat org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:92)\r\n\tat brave.spring.web.TracingClientHttpRequestInterceptor.intercept(TracingClientHttpRequestInterceptor.java:53)\r\n\tat org.springframework.cloud.sleuth.instrument.web.client.LazyTracingClientHttpRequestInterceptor.intercept(TraceWebClientAutoConfiguration.java:293)\r\n\tat org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:92)\r\n\tat org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:76)\r\n\tat org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)\r\n\tat org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)\r\n\tat org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:723)\r\n\tat org.springframework.web.client.RestTemplate.execute(RestTemplate.java:680)\r\n\tat org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:629)\r\n\tat io.mosip.preregistration.core.util.ValidationUtil.getAllDocCategoriesAndTypes(ValidationUtil.java:329)\r\n\tat io.mosip.preregistration.application.service.DocumentService.setup(DocumentService.java:187)\r\n\tat io.mosip.preregistration.application.service.DocumentService$$FastClassBySpringCGLIB$$22bc9d53.invoke()\r\n\tat org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)\r\n\tat org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)\r\n\tat io.mosip.preregistration.application.service.DocumentService$$EnhancerBySpringCGLIB$$2e443631.setup()\r\n\tat io.mosip.preregistration.application.config.ApplicationEventListerner.applicationStartedEvent(ApplicationEventListerner.java:36)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\r\n\tat org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:261)\r\n\tat org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:180)\r\n\tat org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:142)\r\n\tat org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)\r\n\tat org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)\r\n\tat org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)\r\n\tat org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400)\r\n\tat org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354)\r\n\tat org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:97)\r\n\tat org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:72)\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:334)\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)\r\n\tat io.mosip.preregistration.application.PreRegistrationApplication.main(PreRegistrationApplication.java:23)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\r\n\tat org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)\r\n”,“appName”:“pre-registration-application-service”}

Please guide us if any inputs from your side.

Thanks in advance.!

1 Like

Hello MOSIP Team,

Any Update on above ?

Thanks
Ganesh Nawle.

Hi @ganesh_nawle

Based on the above information shared @aihamh will look into this shortly and update you by EOD!

Best Regards,
Team MOSIP

Hi @ganesh_nawle ,

  1. Pre-registration core contains methods and functions which is called by pre-registration-application service internally. No need to run pre-reg core. we can run pre-registration-application service.

  2. Please check if u have added required jars into your project build path. Please check kernel-auth-adapter jar has been added along with other jars into project build path. we need to add settings.xml inside .m2 maven folder. you can get it through here docs.

Please check authservice, iam-adapter config properties are correct in pre-reg-default properties and see if config-server is running. compare it with the develop branch properties pre-reg config properties.

Please check if Keycloak setup is done since we use Keycloak. Other details related to token can be found in MOSIP docs.

Best Regards,
Team MOSIP

Hello @aihamh ,

Thanks for your response. I noted your first point. For second point as you mentioned, I have already added external jar’s which is described in docs. I am attaching the screenshot for same. I have added setting.xml file inside .m2 folder and changed localRepository path. i.e ‘C:/Users/****/.m2/repository’.

But still its giving the same error. From my understanding the error is related to key Cloak. Because it is giving error like “Requesting for new Token for the provided OIDC Service(WebClient): http://localhost:8080/auth/realms/”. FYI my key cloak is running on port 8080.

Please refer the attached attached screen shot for same.

Please assist me if I missed anything. Thanks for your support and guidance.
Ganesh Nawle

1 Like

Hi @ganesh_nawle ,

can you please check if pre-registration default properties values are correct for auth properties. please check for this property.
ie : auth-token-generator.rest.issuerUrl=${iam.base.url}/auth/realms/mosip

Please compare mosip-config develop branch-property with that of yours.

Dear @ganesh_nawle ,

I am here to check back on your query and if you were able to resolve the issue!

Best Regards
Team MOSIP

Hello @keshavs

     We are still facing same issue and we are checking the keycloak setup.Is there any documentation of keycloak setup for local services.Like whats steps we have to follow. 

Thanks and Regards
Ganesh Nawle