Exception in WebServices REST MainResourceController

Distro Reference Application branch - 3.x

https://github.com/openmrs/openmrs-distro-referenceapplication/tree/3.x

I have deployed the refapp branch-3.x successfullly, however, while POST’ing to the URL to create a patient I get an exception:

`proxy_1     | 172.23.0.1 - - [06/May/2021:07:13:12 +0000] "POST /openmrs/ws/rest/v1/patient/ HTTP/1.1" 500 7068
openmrs_1   | WARN - ExceptionHandlerExceptionResolver.doResolveHandlerMethodException(414) |2021-05-06T07:13:13,495| Failure in @ExceptionHandler org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceController#validationExceptionHandler(ValidationException, HttpServletRequest, HttpServletResponse)
openmrs_1   | org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class org.openmrs.module.webservices.rest.SimpleObject
openmrs_1   | 	at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:220) ~[spring-webmvc-5.2.9.RELEASE.jar:5.2.9.RELEASE]
openmrs_1   | 	at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:181) ~[spring-webmvc-5.2.9.RELEASE.jar:5.2.9.RELEASE]
openmrs_1   | 	at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82) ~[spring-web-5.2.9.RELEASE.jar:5.2.9.RELEASE]
openmrs_1   | 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:123) ~[spring-webmvc-5.2.9.RELEASE.jar:5.2.9.RELEASE]
openmrs_1   | 	at org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver.doResolveHandlerMethodException(ExceptionHandlerExceptionResolver.java:407) [spring-webmvc-5.2.9.RELEASE.jar:5.2.9.RELEASE]
openmrs_1   | 	at org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver.doResolveException(AbstractHandlerMethodExceptionResolver.java:61) [spring-webmvc-5.2.9.RELEASE.jar:5.2.9.RELEASE]
openmrs_1   | 	at org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.resolveException(AbstractHandlerExceptionResolver.java:141) [spring-webmvc-5.2.9.RELEASE.jar:5.2.9.RELEASE]`

What dependencies am I missing?

My POST: URL: http://localhost/openmrs/ws/rest/v1/patient/

JSON Body: {"person":{"names":[{"preferred":true,"givenName":"Doe","middleName":"J","familyName":"John"}],"gender":"M","birthdate":"1985-05-22T21:00:00.000Z","birthdateEstimated":false,"attributes":[],"addresses":[{"postalCode":"","address2":"","address1":"","country":"","stateProvince":"","cityVillage":""}],"dead":false},"identifiers":[]}

@mogoodrich @mksrom @ssmusoke

1 Like

@alaboso , is this the whole stack trace?

Not going to fix your issue, but could you set the Webservices REST version to 2.30.0 (as it has been released a few weeks ago) in your pom.xml

And did you try with lower versions? 2.29.0?

@dkayiwa can you help with unblocking this as well?

I would need the full server side tomcat log. Use pastebin.com to share the log.

@dkayiwa - Thanks for checking this out,

Stacktrace on the frontend

Stacktrace on the backend

I hope these are useful

Do you have any other logs? Any that have the stack trace similar to the one you have in the frontend.

Not very different. This is the tomcat log

I’m running it in docker…just in case

What is the name of the file from which you are getting this?

Can you supply a non empty list of identifiers?

Yes, I have. Same error. I am mirroring openmrs-spa.org which is working fine with valid relevant JSON response…

Are you running the same version of the rest webservices module?

No. opemnrs-spa is 2.30.0-SNAPSHOT and am running 2.30.0

I have managed to POST the JSON successfully. So, I chose to use OpenMRS Identification Number identifier which is in default, part of the war package. The Identifier validator was Luhn CheckDigit Validator (default). I changed it to Luhn Mod-30 Check-Digit Validator and included sample identifier JSON in the POST:

"identifiers": [
    {"identifier": "10004EY","identifierType": "8d793bee-c2cc-11de-8d13-0010c6dffd0f","location": "44c3efb0-2583-4c80-a79e-1f756a03c0a1","preferred": false}
]

I will configure auto-generation options.