Java 类型';org/springframework/http/MediaType';(当前帧,堆栈[1])不可分配给';org/springframework/util/MimeType';

Java 类型';org/springframework/http/MediaType';(当前帧,堆栈[1])不可分配给';org/springframework/util/MimeType';,java,spring,spring-mvc,Java,Spring,Spring Mvc,我已将spring从3.2.1升级到4.0.3 得到: "Type 'org/springframework/http/MediaType' (current frame, stack[1]) is not assignable to 'org/springframework/util/MimeType'" 完整堆栈跟踪: Context initialization failed org.springframework.beans.factory.BeanCreationExceptio

我已将spring从3.2.1升级到4.0.3

得到:

"Type 'org/springframework/http/MediaType' (current frame, stack[1]) is 
 not assignable to 'org/springframework/util/MimeType'"
完整堆栈跟踪:

Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.compareMatchingMediaTypes(Lorg/springframework/web/servlet/mvc/condition/ProducesRequestCondition;ILorg/springframework/web/servlet/mvc/condition/ProducesRequestCondition;I)I @83: invokevirtual
  Reason:
    Type 'org/springframework/http/MediaType' (current frame, stack[1]) is not assignable to 'org/springframework/util/MimeType'
  Current Frame:
    bci: @83
    flags: { }
    locals: { 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition', 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition', integer, 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition', integer, integer, 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition$ProduceMediaTypeExpression', 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition$ProduceMediaTypeExpression' }
    stack: { 'org/springframework/http/MediaType', 'org/springframework/http/MediaType' }
  Bytecode:
    0000000: 0336 051c 1504 9f00 0c15 041c 6436 05a7
    0000010: 0049 1c02 9f00 442b b700 3b1c b900 3d02
    0000020: 00c0 0006 3a06 2db7 003b 1504 b900 3d02
    0000030: 00c0 0006 3a07 1906 1907 b600 4136 0515
    0000040: 0599 0008 1505 a700 1019 06b6 0026 1907
    0000050: b600 26b6 0042 3605 1505 ac            
  Stackmap Table:
    append_frame(@18,Integer)
    append_frame(@73,Object[#178],Object[#178])
    same_locals_1_stack_item_frame(@86,Integer)
    chop_frame(@88,2)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.compareMatchingMediaTypes(Lorg/springframework/web/servlet/mvc/condition/ProducesRequestCondition;ILorg/springframework/web/servlet/mvc/condition/ProducesRequestCondition;I)I @83: invokevirtual
  Reason:
    Type 'org/springframework/http/MediaType' (current frame, stack[1]) is not assignable to 'org/springframework/util/MimeType'
  Current Frame:
    bci: @83
    flags: { }
    locals: { 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition', 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition', integer, 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition', integer, integer, 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition$ProduceMediaTypeExpression', 'org/springframework/web/servlet/mvc/condition/ProducesRequestCondition$ProduceMediaTypeExpression' }
    stack: { 'org/springframework/http/MediaType', 'org/springframework/http/MediaType' }
  Bytecode:
    0000000: 0336 051c 1504 9f00 0c15 041c 6436 05a7
    0000010: 0049 1c02 9f00 442b b700 3b1c b900 3d02
    0000020: 00c0 0006 3a06 2db7 003b 1504 b900 3d02
    0000030: 00c0 0006 3a07 1906 1907 b600 4136 0515
    0000040: 0599 0008 1505 a700 1019 06b6 0026 1907
    0000050: b600 26b6 0042 3605 1505 ac            
  Stackmap Table:
    append_frame(@18,Integer)
    append_frame(@73,Object[#178],Object[#178])
    same_locals_1_stack_item_frame(@86,Integer)
    chop_frame(@88,2)

    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.createRequestMappingInfo(RequestMappingHandlerMapping.java:242)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.getMappingForMethod(RequestMappingHandlerMapping.java:191)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.getMappingForMethod(RequestMappingHandlerMapping.java:51)
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$1.matches(AbstractHandlerMethodMapping.java:152)
    at org.springframework.web.method.HandlerMethodSelector$1.doWith(HandlerMethodSelector.java:62)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:480)
    at org.springframework.web.method.HandlerMethodSelector.selectMethods(HandlerMethodSelector.java:58)
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:149)
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:124)
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:103)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:126)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
    ... 21 more

spring问题在我的理解中是隐藏的,可能是什么,从哪里开始搜索?

我认为,这不是升级问题。当应用程序服务器卡住时会发生这种情况。所以,您需要删除服务器并在服务器上运行。

我要说的是检查您的依赖项/类路径。我希望某个地方会有一个冲突的jar(不同的版本)。有同样的问题。使用弹簧4.0.5。删除部署描述符并重新启动服务器后,服务器将再次开始工作。对于NetBeans 8.0.2中的tomee app server 1.7.1,spring 4.0.2是可复制的。这与实际情况非常接近:在删除部署描述符并重新启动后,它再次工作。我在其他系统中遇到了相同的问题(不是spring),但我无法修复它。问题是:。任何建议都是有益的。