spring-hateoas: NoClassDefFoundError if @EnableHypermediaSupport is used without adding spring-plugin dependency

I started to play with spring-hateoas (0.6.0.RELEASE) and found out that adding @EnableHypermediaSupport will cause a NoClassDefFoundError without explicitly adding spring-plugin as dependency:

java.lang.NoClassDefFoundError: org/springframework/plugin/core/support/PluginRegistryFactoryBean
        at org.springframework.hateoas.config.LinkBuilderBeanDefinitionRegistrar.registerBeanDefinitions(LinkBuilderBeanDefinitionRegistrar.java:57)
        at org.springframework.hateoas.config.HypermediaSupportBeanDefinitionRegistrar.registerBeanDefinitions(HypermediaSupportBeanDefinitionRegistrar.java:86)

Also spring-hateoas (0.6.0.RELEASE) depends on spring 3.1.4 and as result fails to process @Configuration classes without adding CGLIB as dependency:

java.lang.IllegalStateException: CGLIB is required to process @Configuration classes. Either add CGLIB to the classpath or remove the following @Configuration bean definitions: [springConfig, org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration]
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:352)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:246)

I was able to make it run without CGLIB by overriding spring dependencies to version 3.2.3.RELEASE.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

Seriously, I just wasted an hour or so fixing this ridiculous exception… because there was no clear answer online anywhere but here. This dependency needs to be explicitly stated in the documentation.

I wrote a blog post about Spring Hateoas, maybe it will be useful for somebody. I don’t know where it is better too put the link so I will leave it here.

http://azagorneanu.blogspot.com/2013/06/hateoas-using-spring-framework.html

Is what documented?

The original issue was to handle the cryptic error message of someone activating a piece of Spring HATEOAS without including Spring Plugin.

Since Spring Plugin will be ALWAYS brought in, the risk has been eliminated. Nothing to document.

I had the same issue today - wasted at least an hour tracking this down. Should at least be some mention of this in the docs.

Still a problem with 0.19.0.RELEASE. Though at least now this issue is the top result in Google for the error message!