Any clues on how to bypass this OMOD deployment error?

Greetings Community.

Am getting started with OpenMRS module development, and have a custom module am trying to get to successfully deploy in OpenMRS 2.4, however, after building the OMOD, I get the error here after attempting to load the module into the system via the module management interface.

I’ve tried to do some research, however, earlier hints were to explicitly add a Spring Core dependency to the module’s main pom file, which I did – check my updated project pom here, however, I still see errors relating to Spring classes not being found. What could be the issue here, and who has some hints on how to overcome this, please share.

Also, seeing as the original module dev hadn’t put any explicit Spring core dependencies in the module’s main pom, I wonder; given that OpenMRS bundles the spring framework, do modules leveraging spring feature need to explicitly reference it in their poms or not?

Thanks.

hello @nemesisfixx
In your logs i see nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver

do u mind adding AnnotationMethodHandlerExceptionResolver in your webModuleApplicationContext.xml and then build a new OMOD file, restart you server and trying deploying again

@nemesisfixx the AnnotationMethodHandlerExceptionResolver class was deprecated and eventually removed in Spring 5, which is the version of spring that OpenMRS platform 2.4 is using. Replace it with ExceptionHandlerExceptionResolver

1 Like

Do you mind giving me an example of the configuration entry I need to add for this to work? Thanks

@nemesisfixx you can look into your code where AnnotationMethodHandlerExceptionResolver is configured from and instead replace it with ExceptionHandlerExceptionResolver as @dkayiwa suggested

Feel free to share the code for your module here

Thanks Cliff. I did apply the recommended transforms to the webModuleApplicationContext.xml everywhere in the module project. Two instances, re-compiled and re-deployed. However, that might not be all that’s wrong with the implementation, as I now get a new error: The following error occurred at startup:Unable to start OpenMRS. Error thrown - Pastebin.com

Worry not though, am picking up an alternate branch of this module and will re-try with that for alternate results. If stuck, perhaps I’ll call on you again Cliff or Kayiwa :wink:

Cheers!

1 Like