org.springframework.beans.factory.BeanCreationException

Error creating bean with name 'mvcContentNegotiationManager': Invocation of init method failed; nested exception is java.lang.ClassCastException: org.springframework.web.accept.HeaderContentNegotiationStrategy cannot be cast to org.springframework.web.accept.ContentNegotiationStrategy

Samebug tips0

There are no available Samebug tips for this exception. If you know how to solve this issue, help other users by writing a short tip.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web19367

  • Error creating bean with name 'mvcContentNegotiationManager': Invocation of init method failed; nested exception is java.lang.ClassCastException: org.springframework.web.accept.HeaderContentNegotiationStrategy cannot be cast to org.springframework.web.accept.ContentNegotiationStrategy
  • Error creating bean with name 'PicketLinkSTS': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
  • Error creating bean with name 'org.springframework.scheduling.config.ScheduledTaskRegistrar#0': Invocation of init method failed; nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
  • Stack trace

    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcContentNegotiationManager': Invocation of init method failed; nested exception is java.lang.ClassCastException: org.springframework.web.accept.HeaderContentNegotiationStrategy cannot be cast to org.springframework.web.accept.ContentNegotiationStrategy at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext$3.call(HttpServiceContext.java:338)[109:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext$3.call(HttpServiceContext.java:334)[109:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.ops4j.pax.swissbox.core.ContextClassLoaderUtils.doWithClassLoader(ContextClassLoaderUtils.java:60)[109:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.callContextInitialized(HttpServiceContext.java:333)[109:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:791)[81:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:294)[82:org.eclipse.jetty.servlet:9.2.10.v20150310] at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)[81:org.eclipse.jetty.server:9.2.10.v20150310] at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doStart(HttpServiceContext.java:245)[109:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)[84:org.eclipse.jetty.util:9.2.10.v20150310] at org.ops4j.pax.web.service.jetty.internal.JettyServerImpl$1.start(JettyServerImpl.java:258)[109:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.ops4j.pax.web.service.internal.HttpServiceStarted.end(HttpServiceStarted.java:1047)[111:org.ops4j.pax.web.pax-web-runtime:4.2.2] at org.ops4j.pax.web.service.internal.HttpServiceProxy.end(HttpServiceProxy.java:413)[111:org.ops4j.pax.web.pax-web-runtime:4.2.2] at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.end(RegisterWebAppVisitorWC.java:380)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.java:692)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.register(WebAppPublisher.java:237)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.addingService(WebAppPublisher.java:182)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.addingService(WebAppPublisher.java:135)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)[org.osgi.core-6.0.0.jar:] at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)[org.osgi.core-6.0.0.jar:] at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAppPublisher.java:101)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.ops4j.pax.web.extender.war.internal.WebObserver.deploy(WebObserver.java:219)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.ops4j.pax.web.extender.war.internal.WebObserver$1.doStart(WebObserver.java:179)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.ops4j.pax.web.extender.war.internal.extender.SimpleExtension.start(SimpleExtension.java:59)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at org.ops4j.pax.web.extender.war.internal.extender.AbstractExtender$1.run(AbstractExtender.java:280)[107:org.ops4j.pax.web.pax-web-extender-war:4.2.2] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66] at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_66] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_66] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_66] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66] at java.lang.Thread.run(Thread.java:745)[:1.8.0_66] Caused by: java.lang.ClassCastException: org.springframework.web.accept.HeaderContentNegotiationStrategy cannot be cast to org.springframework.web.accept.ContentNegotiationStrategy at org.springframework.web.accept.ContentNegotiationManager.<init>(ContentNegotiationManager.java:87)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.web.accept.ContentNegotiationManagerFactoryBean.afterPropertiesSet(ContentNegotiationManagerFactoryBean.java:241)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)[191:ASM-InfraMngr-ServerManagement-Module:0.0.1] ... 47 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    You’re the first here who have seen this exception.