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(Class.java:2583)
	at java.lang.Class.getDeclaredFields(Class.java:1916)
	at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:734)
	... 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?

Mike

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 https://qa-refapp.openmrs.org.

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: webservices.rest-2.31.0-SNAPSHOT.omod

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

Issue tracked via:

https://issues.openmrs.org/browse/RESTWS-819