Running Rep App 2.12.x with OpenMRS 2.6.x

Has anyone tried running the latest 2.x version of the reference app (2.12.2) with the latest master line of OpenMRS Core (2.6.0-SNAPSHOT)?

I just installed a new 2.12.2 Ref App distro via the SDK and then deployed the latest Core build from master and restarted.

I’m seeing the error in the logs during startup:

INFO - ServiceContext.startRefreshingContext(838) |2022-07-26T14:35:41,676| Refreshing Context
java.lang.IllegalStateException: Filters cannot be added to context [/openmrs] as the context has been initialised
	at org.apache.catalina.core.ApplicationContext.addFilter(
	at org.apache.catalina.core.ApplicationContext.addFilter(
	at org.apache.catalina.core.ApplicationContextFacade.addFilter(
	at org.openmrs.web.WebComponentRegistrar.setServletContext(
	at org.openmrs.module.ModuleUtil.refreshApplicationContext(
	at org.openmrs.module.web.WebModuleUtil.refreshWAC(
	at org.openmrs.web.Listener.performWebStartOfModules(
	at org.openmrs.web.Listener.performWebStartOfModules(
	at org.openmrs.web.Listener.startOpenmrs(
	at org.openmrs.web.WebDaemon$
INFO - ServiceContext.doneRefreshingContext(849) |2022-07-26T14:36:04,509| 

OpenMRS appears to start after that, but when I try to go to “/openmrs” I get a 404 error and see the following in the logs:

WARN - DispatcherServlet.noHandlerFound(1281) |2022-07-26T14:37:31,643| No mapping for GET /openmrs/

I could research further, but wanted to check if this was a “known issue” first… apologies if I missed past discussion, I’ve been out of pocket for a few months.

fyi @dkayiwa @ibacher @mseaton

Thanks all! Mark

Hmmm… I confirmed that I have the same problem when running the PIH EMR distro against the latest Core, but in that caes I am not seeing the first error message posted above, so that error could be a red herring.

Which version of tomcat are you running? It looks related to this: [TRUNK-6086] Core on Tomcat 9.x and RA 2.6.x not starting up - OpenMRS Issues

And does this work? ....openmrs/index.htm

@dkayiwa thanks for pointing out the ticket, that does seem to be the behavior I’m seeing… I’m using Apache Tomcat/9.0.52, which is what the SDK appears to using by default.

“openmrs/index.htm” does work, but then when I try to log in I get the following error:

" Invalid or Missing CSRF Token. Try Going Back and Refresh the page after clearing the browser cache. [Back]"

Will try downgrading Tomcat.

Ah, I was looking to see if there was way to configure which version of Tomcat the SDK used, but I’m seeing:

tomcat7-maven-plugin contains the code to run OpenMRS in an embedded Tomcat 7 instance. This is used for serving SDK versions running parts of the platform prior to 2.5.0.

tomcat9-maven-plugin contains the code to run OpenMRS in an embedded Tomcat 9 instance. This is used for serving SDK versions running platform 2.5.0 or newer.

You can either disable CSRF protection by looking for this file in your openmrs application data folder and change this value openmrs-core/ at master · openmrs/openmrs-core · GitHub to false

Or add the csrfguard script to your page as done here: csrfguard or here: TRUNK-6051 adding CsrfGuard script tag · openmrs/openmrs-module-legacyui@c4b8e31 · GitHub

1 Like

That did it, thanks @dkayiwa !

I had to add the csrfguard line to our login gsp.

Also, we weren’t running the latest appui snapshot (which you had added that line to the standard 2.x lab page). I’m going to go ahead and release App UI to get that change into a released version. (it will be the only thing in since the last release).