NoSuchMethodError springframework AnnotationUtil.findAllAnnotationAttributes

时间:2015-05-25 11:49:25

标签: java eclipse spring jetty

我遇到了运行jetty服务器和部署战争的问题。我看到的堆栈:

 

    INFO : jetty.StartJetty - starting jetty using war file ..\serialisation-preview-service\target\serialisation-preview-service-1.3.0-SNAPSHOT.war
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/C:/Users/username/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/C:/Users/username/.m2/repository/org/slf4j/slf4j-log4j12/1.6.2/slf4j-log4j12-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    INFO : org.eclipse.jetty.util.log - jetty-7.2.2.v20101205
    WARN : org.eclipse.jetty.util.log - Can't reuse C:\Users\user~1\AppData\Local\Temp\jetty-0.0.0.0-8080-serialisation-preview-service-1.3.0-SNAPSHOT.war-_-any-, using C:\Users\user~1\AppData\Local\Temp\jetty-0.0.0.0-8080-serialisation-preview-service-1.3.0-SNAPSHOT.war-_-any-_5868725767441939361
    INFO : org.eclipse.jetty.util.log - Extract jar:file:/U:/Code/Serialisation_Fresh2/serialisation-preview-service/target/serialisation-preview-service-1.3.0-SNAPSHOT.war!/ to C:\Users\username\AppData\Local\Temp\jetty-0.0.0.0-8080-serialisation-preview-service-1.3.0-SNAPSHOT.war-_-any-_5868725767441939361\webapp
    INFO : / - Initializing Spring root WebApplicationContext
    INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
    INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Mon May 25 12:39:13 BST 2015]; root of context hierarchy
    INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
    INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@78bc3b: defining beans []; root of factory hierarchy
    INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 1742 ms
    WARN : org.eclipse.jetty.util.log - FAILED jsp: java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
    INFO : / - Initializing Spring FrameworkServlet 'appServlet'
    INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
    INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'appServlet-servlet': startup date [Mon May 25 12:39:15 BST 2015]; parent: Root WebApplicationContext
    INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/servlet-context.xml]
    INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [preview-service-context.xml]
    INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [dao-context.xml]
    WARN : org.eclipse.jetty.util.log - FAILED appServlet: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.findAllAnnotationAttributes(Ljava/lang/Class;Ljava/lang/String;Z)Ljava/util/List;
    WARN : org.eclipse.jetty.util.log - Failed startup of context o.e.j.w.WebAppContext{/,file:/C:/Users/username/AppData/Local/Temp/jetty-0.0.0.0-8080-serialisation-preview-service-1.3.0-SNAPSHOT.war-_-any-_5868725767441939361/webapp/},U:\Code\Serialisation_Fresh2\serialisation-jetty-server\.\..\serialisation-preview-service\target\serialisation-preview-service-1.3.0-SNAPSHOT.war
    MultiException[java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory, java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.findAllAnnotationAttributes(Ljava/lang/Class;Ljava/lang/String;Z)Ljava/util/List;]
        at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:733)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:244)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1181)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:584)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
        at org.eclipse.jetty.server.Server.doStart(Server.java:243)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at jetty.StartJetty.main(StartJetty.java:56)
    java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
        at org.apache.jasper.servlet.JspServlet.(JspServlet.java:61)
        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:513)
        at java.lang.Class.newInstance0(Class.java:357)
        at java.lang.Class.newInstance(Class.java:310)
        at org.eclipse.jetty.servlet.ServletContextHandler$Context.createServlet(ServletContextHandler.java:602)
        at org.eclipse.jetty.servlet.ServletHolder.newInstance(ServletHolder.java:744)
        at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:422)
        at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:260)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:762)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:244)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1181)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:584)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
        at org.eclipse.jetty.server.Server.doStart(Server.java:243)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at jetty.StartJetty.main(StartJetty.java:56)
    Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 24 more
    java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.findAllAnnotationAttributes(Ljava/lang/Class;Ljava/lang/String;Z)Ljava/util/List;
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:209)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:136)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:114)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:239)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigurationClasses(ConfigurationClassPostProcessor.java:199)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:175)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:617)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
        at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:609)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:571)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:623)
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:491)
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:432)
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:432)
        at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:260)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:762)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:244)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1181)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:584)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
        at org.eclipse.jetty.server.Server.doStart(Server.java:243)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at jetty.StartJetty.main(StartJetty.java:56)

 

有人可以就此提出建议吗? NoSuchMethodError是否因为从jetty调用时弹出方法签名不兼容而被抛出?

1 个答案:

答案 0 :(得分:0)

我认为这是由spring.core.jar和.spring.context.jar之间的版本不匹配引起的。请检查一下。

另见: http://apiwave.com/java/snippets/migration/org.springframework.core.annotation.AnnotationUtils&java.lang.annotation.Annotation