Provider scheduling page throwing exception

(Forked from Appointments module with bahmni 0.88)

Hi,

I have managed to get appointments working in bahmni by using specific combinations of omods(listed above in the thread). However when I tried to configure an appointment, hit the following exception from provider scheduling page

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) javax.servlet.http.HttpServlet.service(HttpServlet.java:618) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72) org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54) org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) root causejava.lang.NullPointerException org.openmrs.module.appointmentscheduling.api.impl.AppointmentServiceImpl$1.compare(AppointmentServiceImpl.java:860) org.openmrs.module.appointmentscheduling.api.impl.AppointmentServiceImpl$1.compare(AppointmentServiceImpl.java:857) java.util.TimSort.binarySort(Unknown Source) java.util.TimSort.sort(Unknown Source) java.util.Arrays.sort(Unknown Source) java.util.ArrayList.sort(Unknown Source) java.util.Collections.sort(Unknown Source) org.openmrs.module.appointmentscheduling.api.impl.AppointmentServiceImpl.getAllProvidersSorted(AppointmentServiceImpl.java:857) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) com.sun.proxy.$Proxy216.getAllProvidersSorted(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:121) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) com.sun.proxy.$Proxy217.getAllProvidersSorted(Unknown Source) org.openmrs.module.appointmentscheduling.web.controller.AppointmentBlockCalendarController.getProviderList(AppointmentBlockCalendarController.java:130) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:163) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) javax.servlet.http.HttpServlet.service(HttpServlet.java:618) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72) org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54) org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

Any help in resolving the issue is greatly appreciated…

If you are running this on platform 2.x, then i suspect that you have a provider who is not linked to a person. Can you cross check? https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/Provider.java#L114

http://qa-refapp.openmrs.org/openmrs/admin/provider/index.htm

Thanks @dkayiwa, that is likely the cause. Trying to access the provider page, indicates an error. Looking t openmrs.log, I find 17-03-2017 20:54:08 [WARN ] DefaultRemoter - Method execution failed: java.lang.NullPointerException at org.openmrs.web.dwr.ProviderListItem.(ProviderListItem.java:36) at org.openmrs.web.dwr.DWRProviderService.findProvider(DWRProviderService.java:57) at org.openmrs.web.dwr.DWRProviderService.findProviderCountAndProvider(DWRProviderService.java:78) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283) at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52) at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101) …

However I am not quite sure how I can associate the provider with person when I can’t see the UI. Looking at the database, I see each provider having a valid person id.

mysql> select * from provider; ±------------±----------±---------------±--------------±--------±--------------------±-----------±--------------------±--------±-----------±-------------±--------------±-------------------------------------±-----------------+ | provider_id | person_id | name | identifier | creator | date_created | changed_by | date_changed | retired | retired_by | date_retired | retire_reason | uuid | provider_role_id | ±------------±----------±---------------±--------------±--------±--------------------±-----------±--------------------±--------±-----------±-------------±--------------±-------------------------------------±-----------------+ | 1 | 2 | Lab Manager | LABMANAGER | 1 | 2014-09-18 14:18:06 | NULL | NULL | 0 | NULL | NULL | NULL | 823fdcd7-3f10-11e4-adec-0800271c1b75 | NULL | | 2 | 3 | superman | superman | 1 | 2014-09-18 14:19:53 | NULL | NULL | 0 | NULL | NULL | NULL | c1c26908-3f10-11e4-adec-0800271c1b75 | NULL | | 3 | 4 | NULL | UNKNOWN | 2 | 2014-09-18 14:28:27 | NULL | NULL | 0 | NULL | NULL | NULL | f9badd80-ab76-11e2-9e96-0800200c9a66 | NULL | | 4 | 5 | Lab System | LABSYSTEM | 1 | 2014-09-18 14:32:16 | NULL | NULL | 0 | NULL | NULL | NULL | 7d162c29-3f12-11e4-adec-0800271c1b75 | NULL | | 6 | 6 | Billing System | BILLINGSYSTEM | 1 | 2014-09-18 14:32:23 | NULL | NULL | 0 | NULL | NULL | NULL | 8135e93a-3f12-11e4-adec-0800271c1b75 | NULL | | 7 | 23 | NULL | NULL | 4 | 2015-02-20 13:22:21 | 4 | 2015-02-20 13:22:33 | 0 | NULL | NULL | NULL | df17bca9-ff9b-4a73-bac7-f302fc688974 | NULL | | 8 | 44 | NULL | NULL | 4 | 2015-05-21 13:09:20 | NULL | NULL | 0 | NULL | NULL | NULL | 5d2f67e6-3032-451a-81a8-d2522a48c0ab | NULL | | 9 | 45 | NULL | NULL | 1 | 2015-05-21 13:22:46 | NULL | NULL | 0 | NULL | NULL | NULL | 7da09a86-352a-4c9d-9745-d9a39c364ebe | NULL | | 10 | 46 | NULL | NULL | 1 | 2015-05-21 13:25:14 | NULL | NULL | 0 | NULL | NULL | NULL | cb6c708c-3cee-49ef-a685-18a1e1df120e | NULL | | 11 | 58 | NULL | NULL | 4 | 2016-11-10 12:30:12 | NULL | NULL | 0 | NULL | NULL | NULL | 8725bc82-9ce9-48d3-95c7-1397cb716c84 | NULL | | 12 | 59 | NULL | NULL | 4 | 2016-11-10 12:30:17 | NULL | NULL | 0 | NULL | NULL | NULL | 454a7bed-3c04-4936-b59d-b8f98d068b3e | NULL | | 13 | 60 | NULL | NULL | 4 | 2016-11-10 12:30:22 | NULL | NULL | 0 | NULL | NULL | NULL | 8c3ccd72-74dd-45a6-84e4-d85992784a52 | NULL | | 14 | 61 | NULL | NULL | 4 | 2016-11-10 12:30:28 | NULL | NULL | 0 | NULL | NULL | NULL | b7a915a4-b142-41ab-ae13-a060003885a1 | NULL | | 15 | 62 | NULL | NULL | 4 | 2016-11-10 12:30:33 | NULL | NULL | 0 | NULL | NULL | NULL | f6ac7675-9d6d-4397-a22f-43c2fabab57e | NULL | | 16 | 63 | NULL | NULL | 4 | 2016-11-10 12:30:38 | NULL | NULL | 0 | NULL | NULL | NULL | c195a58f-f873-4a2f-b5e0-d7d575e13015 | NULL | | 17 | 64 | NULL | NULL | 4 | 2016-11-10 12:30:43 | NULL | NULL | 0 | NULL | NULL | NULL | c19c914b-a9f0-4f2b-a148-20e72788d314 | NULL | | 18 | 65 | NULL | NULL | 4 | 2016-11-10 12:30:50 | NULL | NULL | 0 | NULL | NULL | NULL | 6347f791-4939-4039-b384-4c23621137b5 | NULL | | 19 | 66 | NULL | NULL | 4 | 2016-11-10 12:30:55 | NULL | NULL | 0 | NULL | NULL | NULL | cbb1dc59-4ad5-42b2-902b-d891338407f3 | NULL | | 20 | 67 | NULL | NULL | 4 | 2016-11-10 12:31:00 | NULL | NULL | 0 | NULL | NULL | NULL | 1c86834b-db9a-48c1-a412-9c4c8eb0eecb | NULL | | 21 | 68 | NULL | NULL | 4 | 2016-11-10 12:31:05 | NULL | NULL | 0 | NULL | NULL | NULL | 59df9c9b-9b58-4b96-af9e-46a1077c1b60 | NULL | | 22 | 69 | NULL | NULL | 4 | 2016-11-10 12:31:09 | NULL | NULL | 0 | NULL | NULL | NULL | bccb7ee2-35dd-4cf9-94be-544c3011e955 | NULL | ±------------±----------±---------------±--------------±--------±--------------------±-----------±--------------------±--------±-----------±-------------±--------------±-------------------------------------±-----------------+ 21 rows in set (0.00 sec)

I suspect this might be due to the combination of omods I am using, but not really sure…

If you think this could be related to omod compatibility, I would like to know where I can see all the released omods. The demo reference application is using “App UI Module 1.8-SNAPSHOT” whereas https://modules.openmrs.org/#/show/8/appui says 1.5.1 is the latest available.

You have a provider linked to a person with no name. Nevertheless, the module should allow you change to a different person with a name. Can you create a ticket for this?

Thanks @dkayiwa, I have managed to remove the ‘Lab Manager’ with no person_name and the issue disappeared. I have sent a request for JIRA and will open the ticket once I have the access. Thanks again for your quick help…