Integrating openmrs-module-openconceptlab with Bahmni

We are trying to integrate Bahmni with OCL for which we are planning to use Openmrs-module-openconceptlab. I have loaded the openconceptlab omod successfully. I see that opencocnpetlab module has it’s own OWA. So, loaded openmrs-module-owa module and tried to upload openconceptlab.zip. But, I see some errors. @raff Is the approach that I am following correct? Please let me know if I am missing something.

You could also just copy openconceptlab.zip into /opt/openmrs/owa.

Looks like you followed the required steps, what errors did you get?

I am getting HTTP Status 500 - openconceptlab.zip (Permission denied) error. I placed openconceptlab.zip in /opt/openmrs/owa/ and restarted openmrs service. But, still the package was not uploaded.

When I ran the command ‘npm run build:prod’ in openmrs-module-openconceptlab/owa/, I am getting the below error but openconceptlab.zip is being generated in same folder (not in dist folder as mentioned in README.md). I am uploading the same zip package from openmrs.

ERROR in Path must be a string. Received undefined Child html-webpack-plugin for “index.html”: + 1 hidden modules

Assuming you’re on Vagrant or Docker, have you tried this?

chown -R bahmni:bahmni /opt/openmrs/owa

Yes. I did it, but still see the same issue.

You manually copied the .zip into /opt/openmrs/owa, ran chown, restarted OpenMRS and then what exactly is that you observe?

When I go to Manage Apps, I still see ‘You have no apps installed’. And when I go to status page of openconceptlab, I am getting the below error: HTTP Status 404 - /openmrs/owa/openconceptlab/index.html

type Status report

message /openmrs/owa/openconceptlab/index.html

description The requested resource is not available.

I get the same error message for both the dev and prod builds:

ERROR in Path must be a string. Received undefined

Before anything else I’d try to get a clean build of the OWA. Even though the .zip is generated it might be unfit for properly serving the OWA.

Googling around shows that this can be because of a Node version, see here. The trick might be to build with Node < 6.0.0. I just did this and could build without errors (using n that you can install with npm install -g n):

sudo n 5.12.0
rm package-lock.json
npm install
npm run build:prod

Thank you. Followed the same steps (On mac had to use brew install n) and npm run build:prod is now successful. I have loaded the openconceptlib.zip to /opt/openmrs/owa/, did chown and restarted openmrs. But, I still see ‘You have no apps installed’ message, when tried to upload manually also I see ‘Permission denied’ error.

The point was to rule out that the problem was coming from the zipped OWA itself. Btw just to be entirely sure, you might want to try with another zipped OWA, such as a sample one created with the Yeoman generator (the Angular one for instance.)

Could you get a complete stack trace of this permission denied error?

Full Stack Trace:

HTTP Status 500 - openconceptlab.zip (Permission denied)

type Exception report

message openconceptlab.zip (Permission denied)

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.io.FileNotFoundException: openconceptlab.zip (Permission denied) java.io.FileOutputStream.open0(Native Method) java.io.FileOutputStream.open(Unknown Source) java.io.FileOutputStream.(Unknown Source) java.io.FileOutputStream.(Unknown Source) org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:439) org.springframework.web.multipart.commons.CommonsMultipartFile.transferTo(CommonsMultipartFile.java:142) org.openmrs.module.owa.web.controller.AddAppController.upload(AddAppController.java:74) 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:177) 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.doPost(FrameworkServlet.java:868) javax.servlet.http.HttpServlet.service(HttpServlet.java:644) 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.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:64) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72) org.openmrs.module.owa.filter.OwaFilter.doFilter(OwaFilter.java:57) org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70) 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)

@mjsanish I remember that you mentioned something similar, did you ever solve this?

@mksd @pramidat I have also faced same “Permission denied” issue. I am not able to resolve “Permission denied” issue but I am able to integrate my bedmanagement OWA for the development environment. It may be not appropriate for your condition.

Here steps that work for me.

  1. Changes OpenMRS > admin > Open Web Apps Module > setting

  1. Since I am using Vagrant for development, I link the host source content of my OWA app to the vagrant /var/www/html/owa

  2. And bedmanagement OWA appear at OpenMRS > admin > Open Web Apps Module > Manage Apps

  3. On click Bed Management OWA it showup my bedmanagement OWA.

1 Like

Thank you @mjsanish I tried the above steps to deploy openconceptlab owa in my local. Just changed the App Base URL in settings to https://192.168.33.10/openmrs/owa/ as the URL when we click on Openmrs->Administration->Open Concept Lab->Status Page is https://192.168.33.10/openmrs/owa/openconceptlab/index.html#/.

With this, I can see the OWA loaded successfully, but when I tried to open openconceptlab, I still see the same error.

@pramidat It will work if you set Base URL to https://192.168.33.10/owa/ instead of https://192.168.33.10/openmrs/owa/.

If you really want Base URL to https://192.168.33.10/openmrs/owa/ then you have to mount and bind /var/www/html/owa folder to /opt/openmrs/openmrs/owa as below.

$ sudo mkdir /opt/openmrs/openmrs/owa/
$ sudo chown -R bahmni:bahmni /opt/openmrs/openmrs/owa/
$ sudo mount --bind /var/www/html/owa /opt/openmrs/openmrs/owa/

Then check https://192.168.33.10/openmrs/owa/openconceptlab/index.html

1 Like

When I added the base URL as https://192.168.33.10/owa/ , then when I click on openconceptlab, https://192.168.33.10/owa/openconceptlab/index.html is opening up but the page is blank.

If I added the base URl as https://192.168.33.10/openmrs/owa/ and after the mounting and binding, when I click on openconceptlab, https://192.168.33.10/openmrs/owa/openconceptlab/index.html is opening but getting the same error :frowning:

@raff can you please let me know what is the base URL for openconceptlab module

@pramidat, I’m sorry, but I released a version of openconceptlab with a broken UI. I will fix it ASAP.

Update: Taking a step back. I heard about an issue with the UI earlier this week and assumed you had the same, but it is most likely not the case. I just tested and it works for me…

http://localhost:8080/openmrs/owa/openconceptlab/index.html#/ is the entry url.

The base url is empty in my OWA config.

Also the owa should be automatically deployed with a module. No need to do it manually. Please make sure you have the latest version of the Open Web Apps module (1.8.0) as well if it is not working that way.

Lastly, aside from the page being blank, do you see any errors in browser console?

I tested using http://localhost:8080/openmrs/owa as base URL in OWA config and it worked as well.

Could you also look for any errors in server logs?

Also assuming you are using openconceptlab 1.2.1 https://addons.openmrs.org/#/show/org.openmrs.module.open-concept-lab

Update: I was able to reproduce your issue :slight_smile: If I enter http://localhost:8080/openmrs/owa/ as base URL I see blank page for openconceptlab/index.html, whereas when I skip the last slash ( http://localhost:8080/openmrs/owa) it works!

I installed the owa 1.8.0 and openconceptlab 1.2.1 modules on top of Bahmni and I see this error in the activator:

11-12-2017 06:34:15 [WARN ] ModuleUtil - Unable to invoke method on the module’s activator java.lang.IllegalArgumentException: Parameter ‘directory’ is not a directory at org.apache.commons.io.FileUtils.listFiles(FileUtils.java:293) at org.openmrs.module.owa.activator.OwaActivator.contextRefreshed(OwaActivator.java:85) at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:929) at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:866) at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:656) at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:635) at org.openmrs.web.Listener.startOpenmrs(Listener.java:266) at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42)

(I’m stepping into a meeting now so I haven’t been able to debug at all.)

And at https://localhost/openmrs/module/owa/manage.form I see

You have no apps installed