NoClassDefFoundError with Web Services REST 2.31.0-SNAPSHOT and Core 2.4+

We encounter an issue at runtime when using Web Services REST 2.31.0-SNAPSHOT with Core 2.4+

Caused by: java.lang.NoClassDefFoundError: Lorg/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter;
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(
	at java.lang.Class.getDeclaredFields(
	at org.springframework.util.ReflectionUtils.getDeclaredFields(
	... 20 more

Apparently related to using Spring 5.

Full log: Ubuntu Pastebin

Does WS REST support 2.4+?

If so, any idea why it’s failing? @dkayiwa @mseaton @mogoodrich @ibacher @mksd?

(cc @alaboso)

We’ve not yet made the move to the 2.4.x line at any of our PIH distributions, so I don’t (yet) have any direct experience with these issues, unfortunately.

Have you ruled out the warnings related to these as a factor?

java.lang.NoClassDefFoundError: org/openmrs/module/web/extension/AdministrationSectionExt

Is it possible that something relies on the legacyui module and it needs to be included in whatever distribution you are trying to start up?


1 Like

Currently, the REST WS module relies on LegacyUI by using AdministrationSectionExt here. It has been like that since year 2011 so it’s probably not related to compatibility between REST-WS 2.31 and Core 2.4+.

1 Like

The short version is “yes”. This is what we’re currently running on

There are two versions of InitPathMatcher, one 2.3.x and lower and one for 2.4.x and higher, basically to solve exactly this issue. Somehow the version for 2.3.x must not be being excluded from the Spring context?

1 Like

@mksrom do you mind attaching the exact rest webservices module omod file that you are running?

1 Like

@dkayiwa, here is the file:

Yeah, I’ve added Legacy UI too just to make sure, but still get the reported error.

Issue tracked via: