# Errors while building OpenMRS-CORE

**URL:** <https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982>\
**Category:** Development\
**Tags:** developers-forum\
**Created:** [March 13, 2023, 8:12pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982 "2023-03-13T20:12:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 13, 2023, 8:12pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/1 "2023-03-13T20:12:24Z")

</div>

Hallo guys I am working on this issue [Log in - OpenMRS Issues](https://issues.openmrs.org/browse/TRUNK-5362?filter=-1). I cloned the Openmrs-core on my machine and without making any changes I tried to build the package by running mvn-clean-install.

But I got these two errors anyone who can help me understand them better.

[ERROR] Failures: [ERROR] HibernateAlertDAOTest.getAlerts\_shouldReturnAllAlertsWhenUserIsSpecified:69 expected: \<0\> but was: \<1\> [ERROR] HibernateAlertDAOTest.getAllAlerts\_shouldReturnOnlyNonExpiredAllerts:63 expected: \<0\> but was: \<1\> [INFO] [ERROR] Tests run: 4350, Failures: 2, Errors: 0, Skipped: 36 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for OpenMRS 2.5.0-SNAPSHOT: [INFO] [INFO] OpenMRS … SUCCESS [06:20 min] [INFO] openmrs-tools … SUCCESS [03:31 min] [INFO] openmrs-test … SUCCESS [01:22 min] [INFO] openmrs-api … FAILURE [24:07 min] [INFO] openmrs-web … SKIPPED [INFO] openmrs-webapp … SKIPPED [INFO] openmrs-liquibase … SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] -----------------------------------------------------

@jwnasambu @dkayiwa

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [March 13, 2023, 8:24pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/2 "2023-03-13T20:24:55Z")

</div>

Oh sorry @suubi7 . Kindly share the entire error log you are getting using [pastebin](https://pastebin.com/) please!

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 13, 2023, 8:31pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/3 "2023-03-13T20:31:43Z")

</div>

@jwnasambu here is the error log. [Errors while building OpenMRS-CORE - Pastebin.com](https://pastebin.com/t5bT3zrS)

---

<div class="post-metadata">

**Author:** ![thembo42](https://talk.openmrs.org/user_avatar/talk.openmrs.org/thembo42/32/21346_2.png) [@thembo42](https://talk.openmrs.org/u/thembo42)\
**Post date:** [March 14, 2023, 4:14am UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/4 "2023-03-14T04:14:03Z")

</div>

running `mvn clean install` on a freshly cloned OpenMRS core seems to build OpenMRS 2.7.0-SNAPSHOT out of the box.

**Reactor Summary for OpenMRS 2.7.0-SNAPSHOT:**

 ![Screenshot from 2023-03-14 06-46-22](https://talk.openmrs.org/uploads/default/original/3X/d/b/db86a1d482b9e4c67b51f11fe1fc7727e9152f79.png)

Given the error it seems as though its not apparently related to the method in EncounterService causing extreme slowness nor the tests for the EncounterService that located in the `org.openmrs.api.EncounterServiceTest` class. But rather the errors you are seeing are from unit tests because they expected a certain result but got a different one;

- `HibernateAlertDAOTest.getAlerts_shouldReturnAllAlertsWhenUserIsSpecified`: This test was expecting to receive 0 alerts but actually received 1.
- `HibernateAlertDAOTest.getAllAlerts_shouldReturnOnlyNonExpiredAllerts`: This test was also expecting to receive 0 alerts but actually received 1.

You may need to investigate the code and the tests to determine what is causing the unexpected behavior.

But again if this is not related to the issue, i would suggest you provide `logs for any errors or warnings related to the EncounterService` and then do `profiling` to determine the methods and operations related to the slowness. Am not sure about the tools OpenMRS uses here but it would be important to investigate and compare the performance differences .

very important to look at comments on this;

[PR](https://github.com/openmrs/openmrs-core/pull/4184)

[PR](https://github.com/openmrs/openmrs-core/pull/4052)

@dkayiwa @ibacher

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 14, 2023, 9:05am UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/5 "2023-03-14T09:05:44Z")

</div>

Thank you at @thembo. Yes I worked on the EncounterService delay here is the pull request [Issue with method in EncounterService causing extreme slowness by suubi-joshua · Pull Request #4273 · openmrs/openmrs-core · GitHub](https://github.com/openmrs/openmrs-core/pull/4273).

Am still trying to investigate the the two errors I got but also how to test if what I actually did reduces the slowness.

---

<div class="post-metadata">

**Author:** ![thembo42](https://talk.openmrs.org/user_avatar/talk.openmrs.org/thembo42/32/21346_2.png) [@thembo42](https://talk.openmrs.org/u/thembo42)\
**Post date:** [March 14, 2023, 10:38am UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/6 "2023-03-14T10:38:24Z")

</div>

sure! Did you find tools for best practice to get performance metrics?

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 14, 2023, 12:04pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/7 "2023-03-14T12:04:33Z")

</div>

@thembo Do you have some recommendations

---

<div class="post-metadata">

**Author:** ![thembo42](https://talk.openmrs.org/user_avatar/talk.openmrs.org/thembo42/32/21346_2.png) [@thembo42](https://talk.openmrs.org/u/thembo42)\
**Post date:** [March 15, 2023, 6:32am UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/8 "2023-03-15T06:32:32Z")

</div>

[https://wiki.openmrs.org/display/docs/Load+Testing](https://wiki.openmrs.org/display/docs/Load+Testing)

> **[GitHub - openmrs/openmrs-module-metrics: A metrics module for OpenMRS](https://github.com/openmrs/openmrs-module-metrics)**
>
> A metrics module for OpenMRS. Contribute to openmrs/openmrs-module-metrics development by creating an account on GitHub.

> **[GitHub - openmrs/openmrs-module-emrmonitor: OpenMRS server monitoring tool](https://github.com/openmrs/openmrs-module-emrmonitor)**
>
> OpenMRS server monitoring tool. Contribute to openmrs/openmrs-module-emrmonitor development by creating an account on GitHub.

/cc: @ibacher @dkayiwa

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 20, 2023, 7:30pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/9 "2023-03-20T19:30:46Z")

</div>

@jwnasambu @thembo42 @dkayiwaHallo I worked around these errors by changing the value of the AssertEquals to 0 in the methods HibernateAlertDAOTest.getAllAlerts\_shouldReturnOnlyNonExpiredAllerts() and HibernateAlertDAOTest.getAlerts\_shouldReturnAllAlertsWhenUserIsSpecified().

After that I run mvn clean install and the build was successful.

Though my question is why were these methods coded to test if AssertEquals equals 1?

---

<div class="post-metadata">

**Author:** ![thembo42](https://talk.openmrs.org/user_avatar/talk.openmrs.org/thembo42/32/21346_2.png) [@thembo42](https://talk.openmrs.org/u/thembo42)\
**Post date:** [March 20, 2023, 8:15pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/10 "2023-03-20T20:15:30Z")

</div>

hi @suubi7

i doubt changing the value of the Assert statement is better solution as it may reduce the robustness of the test case in the future…

Anyway, i suppose the tests were originally written assuming that there would always be at least one alert in the test database . technically;

if there is only one alert returned by the method being tested, the expectation could be that it should not be expired or it should belong to the user that was specified.

cc/ @ibacher @dkayiwa

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 20, 2023, 8:36pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/11 "2023-03-20T20:36:10Z")

</div>

Exactly AM still trying to figure out the reason why this came up at initial build of the core.

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [March 20, 2023, 9:12pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/12 "2023-03-20T21:12:45Z")

</div>

Are you getting the error before or after making the changes?

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [March 20, 2023, 9:37pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/13 "2023-03-20T21:37:15Z")

</div>

@suubi7 Am not certain if you got a chance to look at the previous comments on the ticket especially the one made by Darius. The changes to be made are supposed to be on 2.x branch. To switch to 2.x branch on your forked repo kindly follow this steps:

```auto
git fetch --all (To fetch all branches from all remotes)
git branch --all (To list all the branches you have)
git checkout 2.x (Ensure its among the listed branches)
git checkout -b TRUNK-5362

```

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 20, 2023, 9:46pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/14 "2023-03-20T21:46:41Z")

</div>

@jwnasambu thanks I had not taken notice of Darius’s comment. This shades new light let me work on that.

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [March 20, 2023, 9:56pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/15 "2023-03-20T21:56:28Z")

</div>

Also take your time to understand the discussion on this link [Method in EncounterService is causing extreme slowness in production - #9 by mogoodrich](https://talk.openmrs.org/t/method-in-encounterservice-is-causing-extreme-slowness-in-production/16229/9).

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 20, 2023, 10:09pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/16 "2023-03-20T22:09:11Z")

</div>

@jwnasambu okay sure thing.

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 26, 2023, 7:44pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/17 "2023-03-26T19:44:13Z")

</div>

@jwnasambu I got the error before making the changes.

---

<div class="post-metadata">

**Author:** ![kdaud](https://talk.openmrs.org/user_avatar/talk.openmrs.org/kdaud/32/13346_2.png) [@kdaud](https://talk.openmrs.org/u/kdaud)\
**Post date:** [March 27, 2023, 12:57am UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/18 "2023-03-27T00:57:01Z")

</div>

@suubi7 what does this command return? `mvn -v`

---

<div class="post-metadata">

**Author:** ![suubi7](https://talk.openmrs.org/user_avatar/talk.openmrs.org/suubi7/32/18525_2.png) [@suubi7](https://talk.openmrs.org/u/suubi7)\
**Post date:** [March 27, 2023, 8:39am UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/19 "2023-03-27T08:39:01Z")

</div>

@kdaud It returns the version of maven I have on my machine

 ![image](https://talk.openmrs.org/uploads/default/original/3X/6/7/67749dccf81fc113afda038ac56b861810e6e92c.png)

Is it connected to the problem.

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [March 27, 2023, 9:04pm UTC](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982/20 "2023-03-27T21:04:08Z")

</div>

Can you try: `git reset --hard`

Then: `git clean -df`

And pull the latest upstream changes.

Finally compile again.

[Next page](https://talk.openmrs.org/t/errors-while-building-openmrs-core/38982.md?page=2)
