0

Использование Maven для создания моего проекта под окнами прекрасно работает, но при развертывании его на Linux-серверах через бамбук на двух серверах это нормально, но на третьем сервере Я получаю NoSuchMethodError относительно одной из весенних библиотек. Если я удаляю весну-ооп: банку с войны, она работает. Если из-за разных версий весны, как работать на двух других Linux-серверах?spring-security-core 2.0.3 spring-aop 2.0.8 причина NoSuchMethodError

Неужели кто-нибудь сталкивался с этой проблемой раньше или имел какие-либо советы относительно того, как я могу отладить эту ошибку дальше?

Любая помощь будет оценена по достоинству.

библиотека дерево

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ pqis-op --- 
[INFO] com.toyotatr.tmem.pqis:pqis-op:war:0.0.1.7-SNAPSHOT 
[INFO] +- com.toyotatr.tmem.pqis:pqis-service:jar:0.0.1-SNAPSHOT:compile 
[INFO] | +- com.toyota.tme.jpa:jpa-support:jar:1.1tk:compile 
[INFO] | +- org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile 
[INFO] | | +- org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile 
[INFO] | | +- org.hibernate:hibernate-commons-  annotations:jar:3.1.0.GA:compile 
[INFO] | | +- org.hibernate:hibernate-core:jar:3.3.0.SP1:compile 
[INFO] | | | \- antlr:antlr:jar:2.7.6:compile 
[INFO] | | \- dom4j:dom4j:jar:1.6.1:compile 
[INFO] | |  \- xml-apis:xml-apis:jar:1.0.b2:compile 
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:3.4.0.GA:compile 
[INFO] | | +- javax.transaction:jta:jar:1.1:compile 
[INFO] | | \- javassist:javassist:jar:3.4.GA:compile 
[INFO] | +- aspectj:aspectjrt:jar:1.5.3:compile 
[INFO] | +- aspectj:aspectjweaver:jar:1.5.3:compile 
[INFO] | +- cglib:cglib:jar:2.2:compile 
[INFO] | | \- asm:asm:jar:3.1:compile 
[INFO] | +- javax.activation:activation:jar:1.1:compile 
[INFO] | +- javax.mail:mail:jar:1.4.2:compile 
[INFO] | \- net.sf.ehcache:ehcache:jar:1.5.0:compile 
[INFO] |  +- backport-util-concurrent:backport-util-concurrent:jar:3.1:compile 
[INFO] |  \- net.sf.jsr107cache:jsr107cache:jar:1.0:compile 
[INFO] +- org.slf4j:slf4j-api:jar:1.5.6:compile 
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.6:compile 
[INFO] +- log4j:log4j:jar:1.2.14:compile 
[INFO] +- org.springframework:spring:jar:2.5.6:compile 
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile 
[INFO] +- org.springframework:spring-context:jar:2.5.6:compile 
[INFO] | +- aopalliance:aopalliance:jar:1.0:compile 
[INFO] | \- org.springframework:spring-beans:jar:2.5.6:compile 
[INFO] +- org.springframework:spring-core:jar:2.5.6:compile 
[INFO] +- javax.annotation:jsr250-api:jar:1.0:compile 
[INFO] +- org.springframework:spring-test:jar:2.5.6:test 
[INFO] +- org.springframework:spring-webmvc:jar:2.5.6:compile 
[INFO] | +- org.springframework:spring-context-support:jar:2.5.6:compile 
[INFO] | \- org.springframework:spring-web:jar:2.5.6:compile 
[INFO] +- javax.servlet:servlet-api:jar:2.5:compile 
[INFO] +- javax.servlet:jstl:jar:1.1.0:compile 
[INFO] +- javax.servlet:jsp-api:jar:2.0:compile 
[INFO] +- taglibs:standard:jar:1.1.0:compile 
[INFO] +- opensymphony:sitemesh:jar:2.4.2:compile 
[INFO] +- org.springframework.security:spring-security-core-tiger:jar:2.0.3:compile 
[INFO] | \- org.springframework.security:spring-security-core:jar:2.0.3:compile 
[INFO] |  +- org.springframework:spring-aop:jar:2.0.8:compile 
[INFO] |  +- org.springframework:spring-support:jar:2.0.8:runtime 
[INFO] |  \- commons-codec:commons-codec:jar:1.3:compile 
[INFO] +- org.springframework.security:spring-security-taglibs:jar:2.0.3:compile 
[INFO] | \- org.springframework.security:spring-security-acl:jar:2.0.3:compile 
[INFO] |  \- org.springframework:spring-jdbc:jar:2.0.8:compile 
[INFO] |  \- org.springframework:spring-dao:jar:2.0.8:compile 
[INFO] +- org.json:json:jar:20140107:compile 
[INFO] +- displaytag:displaytag:jar:1.2:compile 
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile 
[INFO] | +- commons-lang:commons-lang:jar:2.3:compile 
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.7.0:compile 
[INFO] | \- org.slf4j:jcl104-over-slf4j:jar:1.4.2:compile 
[INFO] +- com.lowagie:itext:jar:2.1.7:compile 
[INFO] | +- bouncycastle:bcmail-jdk14:jar:138:compile 
[INFO] | +- bouncycastle:bcprov-jdk14:jar:138:compile 
[INFO] | \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile 
[INFO] |  +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile 
[INFO] |  \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile 
[INFO] +- junit:junit:jar:4.10:compile 
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:compile 
[INFO] \- c3p0:c3p0:jar:0.9.1:compile 
[INFO] 

ошибка

[07-05-2015 15:41:27:928] ERROR org.springframework.web.context.ContextLoader.initWebApplicationContext() - Context initialization failed 
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext-main.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V 
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420) 
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) 
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) 
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) 
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) 
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) 
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) 
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) 
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) 
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) 
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) 
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:788) 
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:434) 
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:780) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:284) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1322) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:732) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:490) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:118) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.addBean(ContainerLifeCycle.java:282) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.addBean(ContainerLifeCycle.java:214) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.updateBeans(ContainerLifeCycle.java:764) 
    at org.eclipse.jetty.server.handler.HandlerCollection.setHandlers(HandlerCollection.java:89) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.setHandlers(ContextHandlerCollection.java:145) 
    at org.eclipse.jetty.server.handler.HandlerCollection.addHandler(HandlerCollection.java:155) 
    at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:41) 
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186) 
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:495) 
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:146) 
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:175) 
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64) 
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:605) 
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:528) 
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:391) 
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69) 
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:145) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69) 
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:557) 
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:232) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:118) 
    at org.eclipse.jetty.server.Server.start(Server.java:342) 
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:100) 
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60) 
    at org.eclipse.jetty.server.Server.doStart(Server.java:290) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69) 
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1250) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174) 
Caused by: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V 
    at org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser$AopAutoProxyConfigurer.configureAutoProxyCreator(AnnotationDrivenBeanDefinitionParser.java:109) 
    at org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser.parse(AnnotationDrivenBeanDefinitionParser.java:80) 
    at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69) 
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297) 
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287) 
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) 
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92) 
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507) 
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) 
    ... 53 more 
+0

Если у вас несколько версий одной и той же банки в вашей WAR, у вас может возникнуть проблема с неправильной версией загружаемой баночки и привести к таким ошибкам. Я считаю, что вам нужно настроить свои объявления зависимостей в своей POM, чтобы убедиться, что вы выбрали одну правильную версию для каждой банки. –

ответ

1

У меня была проблема, как тот, который вы описали в прошлом. Это странное поведение возможно, потому что порядок загрузки класса не гарантируется. Таким образом, возможно, что один и тот же файл WAR работает на одном сервере и не работает на другом.

Простым способом отладки этой проблемы является использование IDE, например eclipse или intellij, и поиск класса AopNamespaceUtils. Если вы обнаружите два или более появления этого класса, вы можете найти банки, которые содержат этот класс, и удалить эти банки (банки с неправильной версией класса) из файла WAR.

Если вы не можете найти его с помощью IDE, вы можете включить журнал отладки classloader и проверить различия между серверами, которые работают/не работают. (Поскольку вы не указали сервер сервлетов/сервер приложений, который вы используете, я не могу указать вам руководство для этого, но это то, что легко найти с помощью Google).