Bahmni Report Authentication Error

I get the following error when Bahmni report is run. Please note that all services including report are running. HTTP Status 500 -

org.bahmni.webclients.WebClientsException: Could not authenticate with OpenMRS

type Status report


org.bahmni.webclients.WebClientsException: Could not authenticate with OpenMRS

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

Apache Tomcat/8.0.12

Bahmni reports essentially verifies that the logged in user is a valid one with OpenMRS user apis. Can you restart just the reporting service and check if the problem persists?

service bahmni-reports restart

Yes, I had done that but no luck. Is it because we backed up data from one machine and restored on other server? Because prior to restoration of data the reports were showing up but after restore we are getting this auth error.

Here is the log file Sep 11, 2017 10:22:55 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler [“http-nio-8051”] 2017-09-11 22:23:20,263 INFO [bahmnireports][org.bahmni.webclients.openmrs.OpenMRSLoginAuthenticator] Executing request: GET http://localhost:8050/openmrs/ws/rest/v1/session HTTP/1.1 2017-09-11 22:23:20,878 INFO [bahmnireports][org.bahmni.webclients.openmrs.OpenMRSLoginAuthenticator] Authentication response: {“sessionId”:“08EAEBE4F5672825CABE1842223FE459”,“authenticated”:false} 2017-09-11 22:23:20,908 ERROR [bahmnireports][org.bahmni.webclients.openmrs.OpenMRSLoginAuthenticator] Could not authenticate with OpenMRS. org.bahmni.webclients.WebClientsException: org.bahmni.webclients.WebClientsException: Could not authenticate with OpenMRS

We found that demo has reports-user which was not present on our server (BTW, is this documented in wiki?) . So when we created this user the authentication error got resolved.

But we are getting the following error: (and reports.json in bahmni_config has not been changed at all)

HTTP Status 500 - Incorrect Configuration Can not construct instance of org.bahmni.reports.model.Config, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information at [Source: { “visitReport10”: { “name”: “Visit Report”, “type”: “visits” }, “vitalsTemplateReport”: { “name”: “Vitals Template Report”, “type”: “obsTemplate”, “config”: { “templateName”: “Vitals”, “patientAttributes”: [ “AADHAAR”, “mobileNo”, “emailId”, “referredBy” ], “applyDateRangeFor”: “encounterCreateDate” } }, “OPD/IPDVisitCount”: { “name”: “OPD/IPD Visit Count”, “type”: “IpdOpdVisitCount” }, “IPDPatientsReport”: { “name”: “IPD Patients Report”, “type”: “ipdPatients”, “config”: { “addressAttributes”: [ “address1”, “city_village” ], “patientAttributes”: [ “AADHAAR”, “mobileNo”, “emailId”, “referredBy” ], “conceptNames”: [ “Height”, “Weight” ], “filterBy”: “Date of Discharge” } }, “patientReport”: { “name”: “Patient Information”, “type”: “PatientReport”, “config”: { “addressAttributes”: [ “address1”, “city_village” ], “patientAttributes”: [ “AADHAAR”, “mobileNo”, “emailId”, “referredBy” ] } }, “concatenatedReport”: { “name”: “ConcatenatedReport”, “type”: “concatenated”, “config”: { “reports”: [ { “name”: “Visit Report”, “type”: “visits”, “config”: { “forDataAnalysis”: true, “patientAttributes”: [ “AADHAAR”, “mobileNo”, “emailId”, “referredBy” ], “visitAttributes”: [ “Visit Status”, “Admission Status” ], “patientAddresses”: [ “address3”, “city_village” ], “applyDateRangeFor”: “visitStopDate”, “visitTypesToFilter”: [ “IPD”, “OPD” ] } } ] } } } ; line: 47, column: 32] (through reference chain: org.bahmni.reports.model.Reports[“patientReport”]->[“config”])

Got this one resolved too. It was due to some extra } in reports.json.

This needs to be documented in Wiki

@nawazshaikh, this error 500 is a problem I am having as well.

To solve this, you have created the user ‘reports-user’ right?

And did you have then to run your reports logged with this user? Just asking because simply creating the user for me did not solve the problem.

@angshuonline in this case, what makes a user a “valid one with OpenMRS user apis”?

OK, I have found that in order to work, there must be a reports-user and its password set such as defined in /etc/bahmni-reports/ (by default Admin123)


I had this issue, too, and identified that there was more than one user with the username of reports-user in OpenMRS.

mysql -u root -p
mysql> use openmrs;
mysql> select user_id, username, password FROM users;
| user_id | username           | password                                                                                                                         |
|      20 | reports-user       | ******************************************************************************************************************************** |
|      21 | reports-user       | ******************************************************************************************************************************** |

Removing the second user was enough to get everything working.