java.lang.ClassNotFoundException: org.springframework.web.socket.config.annotation.WebSocketConfigurer

Hi,I am injecting maven dependency of spring-websocket in my custom module which is using openmrs-2.0.6.My module compile successfully but when I start openmrs application ,openmrs throws java.lang.ClassNotFoundException: org.springframework.web.socket.config.annotation.WebSocketConfigurer execption after refreshing context.Please someone suggest me what I am missing while injecting the dependency.

Pom file

4.0.0 org.openmrs.module notification 1.0.0-SNAPSHOT

<name>Notification API</name>
<description>API project for Notification</description>

	<!-- -->



Those libraries are not include by openmrs core, therefore you need to ship them with your module by removing scope provided

Thank wyclif for reply.When I removed scope provided I am getting following error Unable to refresh the spring application context. Root Cause was: org.springframework.beans.FatalBeanException: Class [org.springframework.context.config.ContextNamespaceHandler] for namespace [] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface WARN - Listener.performWebStartOfModules(700) |2018-09-27 10:15:51,319| caught another error: org.openmrs.api.APIException: Service not found: interface org.openmrs.scheduler.SchedulerService

I know this is childish question but I am struck and tried a lot of thing to resolve this issue.But I am not able to resolve.Please assist me what the problem.

Can you paste the entire log at

Sure … This is the link

Do you have the legacyui module installed and running?

Yes legecyui is installed and running successfully ,If I removed spring-websocket dependencies then my application up and run successfully but when I add spring-websocket dependencies then I get above mentioned error.If required I will share module pom file to you.

Is the module somewhere like on github for me to try it out?

Sure … Following is the link where I committed module

I’ve seen that issue before and it can be annoying to fix, it normally has to do with the fact that you have some duplicate spring jars files and the culprit most likely being spring-context, I think those 2 extra spring dependencies you are adding from your modules are pulling it in transitively, you will need to use the maven dependency tree plugin to identify which one is including it so you can exclude it.

BTW, in the IDE you should be able to quickly look at the jar files on the classpath and confirm if actually you have multiple versions of spring-context.

1 Like