OpenMRS data not syncing with Odoo

Hello

I have successfully installed emr, odoo and openelis. However, bahmni data is not been synced to odoo (patients, drugs). All services are running as expected.

There is no log file under /var/logs/bahmni-erp-connect. Only placeholder file. I even tried creating the log file manually but nothing gets written to the file.

The markers table has these records

There are 1344 records in the failed_events table. I tried resetting the retries for all events to 1 but that did not have any effect on the problem.

image

One of the error messages in the failed_events table is shown below

Failed processing event in feed [http://localhost:8050/openmrs/ws/atomfeed/drug/1]
                    +
 java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integerjava.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast
to java.lang.Integer+
         at org.bahmni.feed.openerp.worker.OpenERPDrugServiceEventWorker.process(OpenERPDrugServiceEventWorker.java:42)
                    +
         at org.ict4h.atomfeed.client.service.AtomFeedClient$EventProcessor.doInTransaction(AtomFeedClient.java:169)
                    +
         at org.ict4h.atomfeed.transaction.AFTransactionWorkWithoutResult.execute(AFTransactionWorkWithoutResult.java:6)
                    +
         at org.ict4h.atomfeed.server.transaction.AtomFeedSpringTransactionSupport$1.doInTransaction(AtomFeedSpringTransactionSupport.java:39)
                    +
         at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
                    +
         at org.ict4h.atomfeed.server.transaction.AtomFeedSpringTransactionSupport.executeWithTransaction(AtomFeedSpringTransactionSupport.java:36)
                    +
         at org.ict4h.atomfeed.client.service.AtomFeedClient.processEvents(AtomFeedClient.java:69)
                    +
         at org.bahmni.feed.openerp.job.SimpleFeedJob.processFeed(SimpleFeedJob.java:26)
                    +
         at org.bahmni.feed.openerp.job.OpenERPDrugFeedJob.processFeed(OpenERPDrugFeedJob.java:17)
                    +
         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.util.MethodInvoker.invoke(MethodInvoker.java:265)
                    +
         at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
                    +
         at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
                    +
         at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
                    +
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
                    +
 Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
                    +
         at org.apache.xmlrpc.parser.XmlRpcResponseParser.addResult(XmlRpcResponseParser.java:61)
                    +
         at org.apache.xmlrpc.parser.RecursiveTypeParserImpl.endValueTag(RecursiveTypeParserImpl.java:78)
                    +
         at org.apache.xmlrpc.parser.XmlRpcResponseParser.endElement(XmlRpcResponseParser.java:186)
                    +
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
                    +
         at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
                    +
         at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
                    +
         at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
                    +
         at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
                    +
         at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
                    +
         at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
                    +
         at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
                    +
         at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
                    +
         at org.apache.xmlrpc.client

The atomfeed console log can be accessed here

Hi @tapologo

Can you give more info on how you setup bahmni? Which bahmni are you using bahmni-lite or bahmni-standard?

Also refer this doc for odoo configuration if you are using docker setup ( Link )

Hello @soorya

I installed the RPM version of bahmni 0.93 on a Centos server because I need to upgrade our prod to 0.93 urgently. I am not using docker for this upgrade, but eventually I will.

I am also seeing this in the atomfeed console log

java.sql.SQLException: Access denied for user 'atomfeed-console'@'localhost' (using password: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) ~[mysql-connector-java-5.1.8.jar!/:na]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) ~[mysql-connector-java-5.1.8.jar!/:na]
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536) ~[mysql-connector-java-5.1.8.jar!/:na]

I have checked the password and it’s correct. I can log in successfully with mysql -u atomfeed-console -p

Please check which event type is failing. Can you send the failed_event URI ?

These are some of the feed URIs in the failed events table

  646 | http://localhost:8050/openmrs/ws/atomfeed/lab/recent       |       1
 1326 | http://localhost:8050/openmrs/ws/atomfeed/drug/recent      |       1
 1328 | http://localhost:8050/openmrs/ws/atomfeed/drug/recent      |       1
 1329 | http://localhost:8050/openmrs/ws/atomfeed/drug/recent      |       1
 1331 | http://localhost:8050/openmrs/ws/atomfeed/encounter/recent |       1
 1332 | http://localhost:8050/openmrs/ws/atomfeed/patient/recent   |       1
 1330 | http://localhost:8050/openmrs/ws/atomfeed/patient/recent   |       1
 1333 | http://localhost:8050/openmrs/ws/atomfeed/encounter/recent |       1

Have you restored some database backup? Or is it just Bahmni 0.93 installation ?

It’s a new installation of 0.93 with no database restoration.

@mohant any ideas on this? I still haven’t been able t resolve the issue. Nothing is being synced to Odoo

I am working through what seem to be similar issues. We are migrating a previous system to 0.93 on centos 7, and it seems the last step for us is trying to get Odoo up.

I also noticed that no log is being written for bahmni-erp-connect. I changed the “WARN” entries to “DEBUG” in /opt/bahmni-erp-connect/bahmni-erp-connect/WEB-INF/classes/log4j2.xml, and it started to write errors to /opt/bahmni-erp-connect/nohup.out. These show an error related to a null value for filePattern in log4j2.xml. I haven’t been able to figure out why, but was wondering if it is a version conflict for log4j? I also removed a blank line at the start of that xml file. If you can get error logs for bahmni-erp-connect that would probably help.

On our system we did migrate the openmrs and clinlims databases, and so Odoo is currently processing their atomfeeds. Hoping the system works after this, but for some reason our markers database still doesn’t have the encounter entry.

I’m not very experienced in this, but these are some other things I’ve tried which could be helpful:

  • Try opening http://<serverip>/openmrs/ws/atomfeed/drug/1 to see if there is something obviously wrong about the feed entry. You can open the links in the feed to the items in the REST api, like: https://<serverip>/openmrs/ws/rest/v1/reference-data/drug/afdbc044-b524-4500-b4cf-4bd7dfca117c
  • you can run /opt/bahmni-erp-connect/bin/bahmni-erp-connect stop and then /opt/bahmni-erp-connect/bin/bahmni-erp-connect debug to start bahmni-erp-connect in debug mode. Then you can find out the debug port (on mine its address=8002). I do this by using ps with the pid of the process. Then if you have jdk-1.8 installed, you can attach the debugger: jdb -attach 8002. Then you can catch the java.lang.ClassCastException and look at the state of variables and walk up the stack trace to understand what happened.

On our system, I tried building a more recent openerp-atomfeed-service (befbb41b1eea6) from source, and dropped it in place of the one that came with 0.93. I had to change some things to get the logging to be written to the right place, but now it’s working. I can see that on our system the encounters feed is being read. Hopefully I can just let it process these for a day or so.

Taking from the master of bahmni-erp-connect may not be advisable. But I think there are more things that may be wrong and need to be investigated first, before going with a build from master. The logs must be written - but I am wondering why not. if the Log4j2 xml file is wrong - then this must be corrected (although I cant figure out why specifically in your case).

@mohant @gokul can you help here?