UI Framework error after any restart of a Distribution server installed with SDK

After installing the OpenMRS SDK:

$ mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:setup-sdk

I created a new server:

$ mvn openmrs-sdk:setup

For the questions it asked, I chose

  • 1) Distribution,
  • 2) Reference Application 2.9.0,
  • the default ports,
  • 1) MySQL 5.6 (requires pre-installed MySQL 5.6),
  • the default database URI,
  • the root credentials for my MySQL instance, and
  • 1) JAVA_HOME (currently: /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre).

I then started the server:

(cd ~/openmrs/server; mvn openmrs-sdk:run -DserverId=server)

After visiting http://localhost:8080/openmrs/ in my browser and waiting for the install to complete, I logged in using the credentials admin/Admin123. I then clicked “Appointment Scheduling” and saw the menu for scheduling appointments.

Back in my shell, I pressed control-C to kill the server. Without doing anything else, I then restarted it:

(cd ~/openmrs/server; mvn openmrs-sdk:run -DserverId=server)

After visiting http://localhost:8080/openmrs/ in my browser, I logged in using the credentials admin/Admin123. I then clicked “Appointment Scheduling” and saw this error message instead:

org.openmrs.ui.framework.UiFrameworkException: viewProvider appointmentschedulingui does not have a view named home
	at org.openmrs.ui.framework.page.PageFactory.getView(PageFactory.java:295)
	at org.openmrs.ui.framework.page.PageFactory.processThisFragment(PageFactory.java:183)
	at org.openmrs.ui.framework.page.PageFactory.process(PageFactory.java:116)
	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)
	…

Meanwhile, the following is visible in my shell:

WARN - OpenmrsClassLoader.expandURL(800) |…| Cannot find jar at: /home/user/openmrs/server/.openmrs-lib-cache/appointmentschedulingui/appointmentschedulingui.jar for url: jar:file:/home/user/openmrs/server/.openmrs-lib-cache/appointmentschedulingui/appointmentschedulingui.jar!/web/module/pages/home.gsp
WARN - OpenmrsClassLoader.expandURL(800) |…| Cannot find jar at: /home/user/openmrs/server/.openmrs-lib-cache/appointmentschedulingui/appointmentschedulingui.jar for url: jar:file:/home/user/openmrs/server/.openmrs-lib-cache/appointmentschedulingui/appointmentschedulingui.jar!/web/module/pages/home.gsp
ERROR - PageController.handlePath(155) |…| viewProvider appointmentschedulingui does not have a view named home
org.openmrs.ui.framework.UiFrameworkException: viewProvider appointmentschedulingui does not have a view named home
        at org.openmrs.ui.framework.page.PageFactory.getView(PageFactory.java:295)
        at org.openmrs.ui.framework.page.PageFactory.processThisFragment(PageFactory.java:183)
        at org.openmrs.ui.framework.page.PageFactory.process(PageFactory.java:116)
        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)
        …

Indeed, the folder /home/user/openmrs/server/.openmrs-lib-cache/appointmentschedulingui is empty.

This seems like a bug to me. Is that correct, or is there anything that I did that would explain why appointmentschedulingui is crashing? If it is a bug, how should I report it, and is any workaround possible?

Thank you for your help!

I have at least found a potential workaround. In the log message from the second run of the server there is this tidbit:

org.openmrs.api.db.DAOException: Unable to deserialize object: Serialized org.openmrs.module.appointmentscheduling.reporting.dataset.definition.AppointmentDataSetDefinition named <appointmentschedulingui.appointmentDataSetDefinition.dailyAppointments>
	at org.openmrs.api.db.hibernate.HibernateSerializedObjectDAO.convertSerializedObject(HibernateSerializedObjectDAO.java:302)
	at org.openmrs.module.reporting.definition.service.SerializedDefinitionServiceImpl.getDefinitionByUuid(SerializedDefinitionServiceImpl.java:123)
	…
Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.openmrs.module.reporting.common.SortCriteria$SortElement as it does not have a no-args constructor : Cannot construct org.openmrs.module.reporting.common.SortCriteria$SortElement as it does not have a no-args constructor
	…

where org.openmrs.module.reporting.common.SortCriteria$SortElement suggests looking in https://github.com/openmrs/openmrs-module-reporting, and, indeed, the latest version has the missing no-args constructor.

So after

$ mkdir -p ~/git
$ cd ~/git
$ git clone https://github.com/openmrs/openmrs-module-reporting.git
$ cd openmrs-module-reporting/
$ mvn package
$ rm ~/openmrs/server/modules/reporting-1.17.0.omod
$ cp ./omod/target/reporting-1.20.0-SNAPSHOT.omod ~/openmrs/server/modules/

I am able to run the Distribution server without issues.

Does this mean that reporting-1.17.0.omod is buggy, or incompatible with another module that the SDK installs?

It means that you need to use the latest version of the reporting module which has the fix. :smile:

Certainly :slight_smile:. But it seems like a bug that the SDK does not know that. I will file a bug report if my helpdesk request for JIRA access is granted.

Bug filed as SDK-244.