Error Encountered While Running OpenMRS Webservices.rest API Locally - Need Step-by-Step Guidance

I followed the official OpenMRS documentation and successfully set up OpenMRS core along with the database on my local machine. The OpenMRS core is running without any issues, and the database connection is working as expected.

However, when I attempt to run the webservices.rest API, I encounter errors. I’ve gone through the setup multiple times and tried various troubleshooting steps, but the issue persists.

Steps Taken:

  1. Installed OpenMRS core and connected it to my local database.
  2. Followed all the necessary steps for setting up webservices.rest API.
  3. The OpenMRS core runs successfully.
  4. I encounter errors specifically when trying to access the web services.

** Full log **:

Error Log Details: - Pastebin.comFull Logs

### **Error Details**:
 -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest
[ERROR] Tests run: 53, Failures: 0, Errors: 39, Skipped: 0, Time elapsed: 0.538 s <<< FAILURE! - in org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest
[ERROR] getResourceByName_shouldReturnResourceForGivenNameAndIgnoreUnannotatedResources(org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest)  Time elapsed: 0.351 s  <<< ERROR!
java.lang.IllegalAccessException: Can not set static final java.lang.String field org.openmrs.util.OpenmrsConstants.OPENMRS_VERSION_SHORT to java.lang.String
        at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest.setCurrentOpenmrsVersion(RestServiceImplTest.java:227)
        at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest.getResourceByName_shouldReturnResourceForGivenNameAndIgnoreUnannotatedResources(RestServiceImplTest.java:208)

[ERROR] getResourceBySupportedClass_shouldReturnResourceSupportingGivenClassAndCurrentOpenmrsVersion(org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest)  Time elapsed: 0 s  <<< ERROR!
java.lang.IllegalAccessException: Can not set static final java.lang.String field org.openmrs.util.OpenmrsConstants.OPENMRS_VERSION_SHORT to java.lang.String
        at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest.setCurrentOpenmrsVersion(RestServiceImplTest.java:227)
        at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest.getResourceBySupportedClass_shouldReturnResourceSupportingGivenClassAndCurrentOpenmrsVersion(RestServiceImplTest.java:367)

[ERROR] initialize_shouldClearCachedResourcesAndSearchHandlersAndReinitializeThem(org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest)  Time elapsed: 0 s  <<< ERROR!
java.lang.IllegalAccessException: Can not set static final java.lang.String field org.openmrs.util.OpenmrsConstants.OPENMRS_VERSION_SHORT to java.lang.String
        at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest.setCurrentOpenmrsVersion(RestServiceImplTest.java:227)
        at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest.initialize_shouldClearCachedResourcesAndSearchHandlersAndReinitializeThem(RestServiceImplTest.java:1137)

[ERROR] getResourceByName_shouldReturnResourceForGivenName(org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest)  Time elapsed: 0.016 s  <<< ERROR!
java.lang.IllegalAccessException: Can not set static final java.lang.String field org.openmrs.util.OpenmrsConstants.OPENMRS_VERSION_SHORT to java.lang.String
        at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest.setCurrentOpenmrsVersion(RestServiceImplTest.java:227)
        at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImplTest.getResourceByName_shouldReturnResourceForGivenName(RestServiceImplTest.java:190)

What I Need Help With:

Could someone please help me by providing step-by-step guidance for:

  • Which repository to pull the code from.
  • The correct branch to use for the webservices.rest API.
  • Any specific code or configuration changes that I might be missing.

I would really appreciate it if someone could walk me through the process to resolve the issue and successfully run the OpenMRS API.

Thank you!

What is the output of this command? mvn -v