# OpenMRS data not syncing with Odoo

**URL:** <https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203>\
**Category:** Bahmni\
**Tags:** atom-feed, bahmni-connect, odoo\
**Created:** [March 28, 2023, 9:03am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203 "2023-03-28T09:03:06Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)\
**Post date:** [March 28, 2023, 9:03am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/1 "2023-03-28T09:03:06Z")

</div>

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

 ![image](https://talk.openmrs.org/uploads/default/original/3X/5/b/5b5bd47f543316c9c9501f3df201d6a5be88ae48.png)

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](https://talk.openmrs.org/uploads/default/original/3X/9/2/923e2dc424ef602a5fa94bd3cc3e8df24c500955.png)

One of the error messages in the failed\_events table is shown below

```auto
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

```

---

<div class="post-metadata">

**Author:** ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)\
**Post date:** [March 28, 2023, 9:09am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/2 "2023-03-28T09:09:42Z")

</div>

The atomfeed console log can be accessed [here](https://pastebin.com/4UdxnnAh)

---

<div class="post-metadata">

**Author:** ![soorya](https://talk.openmrs.org/letter_avatar/soorya/32/5_5575768a8748004e209b776fc1b2916d.png) [@soorya](https://talk.openmrs.org/u/soorya)\
**Post date:** [April 4, 2023, 4:50am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/3 "2023-04-04T04:50:30Z")

</div>

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](https://bahmni.atlassian.net/wiki/spaces/BAH/pages/3117482082/Odoo+Configurations+docker) )

---

<div class="post-metadata">

**Author:** ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)\
**Post date:** [April 4, 2023, 6:39am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/4 "2023-04-04T06:39:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)\
**Post date:** [April 4, 2023, 10:18am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/5 "2023-04-04T10:18:06Z")

</div>

I am also seeing this in the atomfeed console log

```auto
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`

---

<div class="post-metadata">

**Author:** ![mohant](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mohant/32/15443_2.png) [@mohant](https://talk.openmrs.org/u/mohant)\
**Post date:** [April 4, 2023, 2:08pm UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/6 "2023-04-04T14:08:09Z")

</div>

Please check which event type is failing. Can you send the failed\_event URI ?

---

<div class="post-metadata">

**Author:** ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)\
**Post date:** [April 4, 2023, 2:16pm UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/7 "2023-04-04T14:16:39Z")

</div>

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

```auto
  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

```

---

<div class="post-metadata">

**Author:** ![mohant](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mohant/32/15443_2.png) [@mohant](https://talk.openmrs.org/u/mohant)\
**Post date:** [April 4, 2023, 2:23pm UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/8 "2023-04-04T14:23:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)\
**Post date:** [April 4, 2023, 2:31pm UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/9 "2023-04-04T14:31:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)\
**Post date:** [June 8, 2023, 9:09am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/10 "2023-06-08T09:09:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mdg583](https://talk.openmrs.org/letter_avatar/mdg583/32/5_5575768a8748004e209b776fc1b2916d.png) [@mdg583](https://talk.openmrs.org/u/mdg583)\
**Post date:** [April 27, 2024, 8:02am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/11 "2024-04-27T08:02:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mdg583](https://talk.openmrs.org/letter_avatar/mdg583/32/5_5575768a8748004e209b776fc1b2916d.png) [@mdg583](https://talk.openmrs.org/u/mdg583)\
**Post date:** [April 27, 2024, 11:08am UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/12 "2024-04-27T11:08:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![angshuonline](https://talk.openmrs.org/user_avatar/talk.openmrs.org/angshuonline/32/4925_2.png) [@angshuonline](https://talk.openmrs.org/u/angshuonline)\
**Post date:** [May 15, 2024, 2:13pm UTC](https://talk.openmrs.org/t/openmrs-data-not-syncing-with-odoo/39203/13 "2024-05-15T14:13:34Z")

</div>

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?
