org.springframework.beans.factory.BeanCreationException

Error creating bean with name 'contentNegotiatingViewResolver' defined in ServletContext resource [/WEB-INF/app-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value application/xml from type 'java.lang.String' to type 'org.springframework.http.MediaType'; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value application/xml from type 'java.lang.String' to type 'org.springframework.http.MediaType'; nested exception is java.lang.reflect.InvocationTargetException

Samebug tips0

We couldn't find tips for this exception.

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

Solutions on the web14

  • via Unknown by Gerrit Brehmer,
  • via Unknown by Gerrit Brehmer,
  • Stack trace

    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentNegotiatingViewResolver' defined in ServletContext resource [/WEB-INF/app-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value application/xml from type 'java.lang.String' to type 'org.springframework.http.MediaType'; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value application/xml from type 'java.lang.String' to type 'org.springframework.http.MediaType'; nested exception is java.lang.reflect.InvocationTargetException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4266) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) Caused by: org.springframework.core.convert.ConversionFailedException: Unable to convert value application/xml from type 'java.lang.String' to type 'org.springframework.http.MediaType'; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value application/xml from type 'java.lang.String' to type 'org.springframework.http.MediaType'; nested exception is java.lang.reflect.InvocationTargetException at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:40) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:138) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:201) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:155) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:461) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1363) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1322) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) ... 31 more Caused by: org.springframework.core.convert.ConversionFailedException: Unable to convert value application/xml from type 'java.lang.String' to type 'org.springframework.http.MediaType'; nested exception is java.lang.reflect.InvocationTargetException at org.springframework.core.convert.support.ObjectToObjectConverter.convert(ObjectToObjectConverter.java:82) at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:37) ... 39 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:501) at org.springframework.core.convert.support.ObjectToObjectConverter.convert(ObjectToObjectConverter.java:70) ... 40 more Caused by: java.lang.IllegalArgumentException: Invalid token character '/' in token "application/xml" at org.springframework.http.MediaType.checkToken(MediaType.java:286) at org.springframework.http.MediaType.<init>(MediaType.java:257) at org.springframework.http.MediaType.<init>(MediaType.java:207) at org.springframework.http.MediaType.<init>(MediaType.java:196) ... 45 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

    Unknown visitor
    Unknown visitorOnce,