java.lang.NoClassDefFoundError: javax/ws/rs/Path

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I am using the latest restbucks example app from Oliver and I came across this exception: {noformat} Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter cannot be found by org.springframework.data.core_1.7.0.20140120-CI at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 59 more {noformat} followed by another one: {noformat} java.lang.NoClassDefFoundError: javax/ws/rs/Path at org.springframework.hateoas.config.LinkBuilderBeanDefinitionRegistrar$JaxRsEntityControllerBuilderDefinitionBuilder.getBeanDefinition(LinkBuilderBeanDefinitionRegistrar.java:99) at org.springframework.hateoas.config.LinkBuilderBeanDefinitionRegistrar.registerBeanDefinitions(LinkBuilderBeanDefinitionRegistrar.java:74) at org.springframework.hateoas.config.HypermediaSupportBeanDefinitionRegistrar.registerBeanDefinitions(HypermediaSupportBeanDefinitionRegistrar.java:96) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:319) {noformat} All this happens because of classloader confusion in Spring IDE, where the classloader that is being used for reading the JavaConfig is using a parent classloader from Spring IDE (org.springframework.ide.eclipse.core) that is itself having a DynamicImport-Package: * on its manifest. This opens the door to various issues around loading classes from the IDE instead of the project classpath.
    via by Martin Lippert (c),
  • I am using the latest restbucks example app from Oliver and I came across this exception: {noformat} Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter cannot be found by org.springframework.data.core_1.7.0.20140120-CI at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 59 more {noformat} followed by another one: {noformat} java.lang.NoClassDefFoundError: javax/ws/rs/Path at org.springframework.hateoas.config.LinkBuilderBeanDefinitionRegistrar$JaxRsEntityControllerBuilderDefinitionBuilder.getBeanDefinition(LinkBuilderBeanDefinitionRegistrar.java:99) at org.springframework.hateoas.config.LinkBuilderBeanDefinitionRegistrar.registerBeanDefinitions(LinkBuilderBeanDefinitionRegistrar.java:74) at org.springframework.hateoas.config.HypermediaSupportBeanDefinitionRegistrar.registerBeanDefinitions(HypermediaSupportBeanDefinitionRegistrar.java:96) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:319) {noformat} All this happens because of classloader confusion in Spring IDE, where the classloader that is being used for reading the JavaConfig is using a parent classloader from Spring IDE (org.springframework.ide.eclipse.core) that is itself having a DynamicImport-Package: * on its manifest. This opens the door to various issues around loading classes from the IDE instead of the project classpath.
    via by Martin Lippert,
    • java.lang.NoClassDefFoundError: javax/ws/rs/Path at org.springframework.hateoas.config.LinkBuilderBeanDefinitionRegistrar$JaxRsEntityControllerBuilderDefinitionBuilder.getBeanDefinition(LinkBuilderBeanDefinitionRegistrar.java:99) at org.springframework.hateoas.config.LinkBuilderBeanDefinitionRegistrar.registerBeanDefinitions(LinkBuilderBeanDefinitionRegistrar.java:74) at org.springframework.hateoas.config.HypermediaSupportBeanDefinitionRegistrar.registerBeanDefinitions(HypermediaSupportBeanDefinitionRegistrar.java:96) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:319)
    No Bugmate found.