UI Framework Error: NullPointerException: Cannot get property 'uuid' on null object.

Module: Appointment Scheduling UI Module

Module Version: 1.5.1-SNAPSHOT

System Version: 1.12.0

Issue: After installation of the new version, I get the following error: UI Framework Error Root Error

Full Error
org.openmrs.ui.framework.ViewException: (in 'decorator/standardEmrPage')
*** In view 'header', NullPointerException: Cannot get property 'uuid' on null object.
Passed from controller: 
  sessionContext -> org.openmrs.module.appui.UiSessionContext@5ba5adda
  featureToggles -> org.openmrs.module.appframework.feature.FeatureToggleProperties@5a38f237
  loginLocations -> [General Ward, Labour Ward, OPD-1, Registration Desk]
  configSettings -> null
  userAccountMenuItems -> []
  patient -> null
  ui -> org.openmrs.ui.framework.fragment.FragmentUiUtils@50a62727
  context -> org.openmrs.api.context.Context@4c549ace
  contextPath -> openmrs
  session -> org.openmrs.ui.framework.session.Session@467f7188
  param -> {}
  out -> java.io.PrintWriter@58f6bbe0
  config -> {id=fr6644}
	at org.openmrs.ui.framework.fragment.GroovyFragmentView.render(GroovyFragmentView.java:67)
	at org.openmrs.ui.framework.fragment.FragmentFactory.processThisFragment(FragmentFactory.java:195)
	at org.openmrs.ui.framework.fragment.FragmentFactory.process(FragmentFactory.java:124)
	at org.openmrs.ui.framework.page.PageFactory.process(PageFactory.java:123)
	at org.openmrs.ui.framework.page.PageFactory.handle(PageFactory.java:86)
	at org.openmrs.module.uiframework.PageController.handlePath(PageController.java:116)
	at org.openmrs.module.uiframework.PageController.handleUrlWithDotPage(PageController.java:83)
	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.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:61)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72)
	at org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:230)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:534)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
	at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.openmrs.ui.framework.ViewException: *** In view 'header', NullPointerException: Cannot get property 'uuid' on null object.
Passed from controller: 
  sessionContext -> org.openmrs.module.appui.UiSessionContext@5ba5adda
  featureToggles -> org.openmrs.module.appframework.feature.FeatureToggleProperties@5a38f237
  loginLocations -> [General Ward, Labour Ward, OPD-1, Registration Desk]
  configSettings -> null
  userAccountMenuItems -> []
  patient -> null
  ui -> org.openmrs.ui.framework.fragment.FragmentUiUtils@50a62727
  context -> org.openmrs.api.context.Context@4c549ace
  contextPath -> openmrs
  session -> org.openmrs.ui.framework.session.Session@467f7188
  param -> {}
  out -> java.io.PrintWriter@58f6bbe0
  config -> {id=fr6644}
	at org.openmrs.ui.framework.fragment.GroovyFragmentView.render(GroovyFragmentView.java:64)
	at org.openmrs.ui.framework.fragment.FragmentFactory.processThisFragment(FragmentFactory.java:195)
	at org.openmrs.ui.framework.fragment.FragmentFactory.process(FragmentFactory.java:124)
	at org.openmrs.ui.framework.fragment.FragmentContext.includeFragment(FragmentContext.java:54)
	at org.openmrs.ui.framework.UiUtils.includeFragment(UiUtils.java:152)
	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.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
	at SimpleTemplateScript2.run(SimpleTemplateScript2.groovy:38)
	at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.writeTo(SimpleTemplateEngine.java:165)
	at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.toString(SimpleTemplateEngine.java:177)
	at org.openmrs.ui.framework.fragment.GroovyFragmentView.render(GroovyFragmentView.java:46)
	... 66 more
Caused by: java.lang.NullPointerException: Cannot get property 'uuid' on null object
	at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:56)
	at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:156)
	at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:235)
	at SimpleTemplateScript4.run(SimpleTemplateScript4.groovy:125)
	at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.writeTo(SimpleTemplateEngine.java:165)
	at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.toString(SimpleTemplateEngine.java:177)
	at org.openmrs.ui.framework.fragment.GroovyFragmentView.render(GroovyFragmentView.java:46)
	... 83 more

Are you able to reproduce it here? http://qa-refapp.openmrs.org/openmrs/

I don’t think so. I just installed this module and it’s dependencies, then error occurs.

Error appears somewhere in UI Framework, when I remove the following code page loads fine:

<%
    ui.decorateWith("appui", "standardEmrPage")
%>

P.S. Module version 1.3 worked well, but I couldn’t package it with Maven, so I decided to use new version, but this happened. Is it possible that problem appears because I’m using OpenMRS 1.12?

Can you paste the full tomcat log at pastebin.com?

I couldn’t paste full log, it’s too big. I pasted part which starts from the begining of the error to the end of the file. http://pastebin.com/j01qw9kB

You can stop tomcat, delete the logs, then start tomcat again and reproduce the error. You will now have a smaller log.

Even in this case, log fills instantly, the minimal size i’ve got so far is about 5Mb. P.S. I’m using Bahmni, maybe error somehow related to that?

Can you post this to the bahmni talk category?

You mean copy or change the category of this post? I’m not sure that the problem related to Bahmni, so I posted it under this category. Sorry, it seems that I was looking another log file.

http://pastebin.com/ZHNNPCME

The issue here is that, from the OpenMRS perspective you have logged in via the legacy UI (and therefore you have not chosen a session location) but you’re trying to view a page that comes from the newer reference application UI (which requires a session location).

Peeking at the code, there’s a bugfix for this specific error in the appui module, but it hasn’t been released yet. (But that just fixes the page header; it’s possible other things will fail subsequently if you have no session location set.)

This is the same problem that @sravanthi17 is running into at Appointment Scheduling is Broken On Openmrs Demo Instance. (Any chance you’re collaborating, and able to solve this together?)

Ideally you would log in from the Bahmni login screen (which requires a session location) rather than via the OpenMRS UI. (@sravanthi17 would that work?)

You can try building the latest version of the https://github.com/openmrs/openmrs-module-appui module from source, to see if this resolves the problem also.

Thanks @darius. We will try with latest appui and see if that works.

This solved the problem. Thanks @darius

Thanks @darius. It’s finally working.