我的STS 3.9.4.RELEASE (Build: 201804120921, Platform: Eclipse Oxygen.3a 4.7.3a)
经常因以下原因而崩溃:
!ENTRY org.springframework.ide.eclipse.beans.core 1 0 2018-04-26 09:23:26.627
!MESSAGE Error occured processing '/project/WebContent/WEB-INF/context/security.xml'
!STACK 0
java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.setSource(Ljava/lang/Object;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
at org.springframework.security.config.ConcurrentSessionsBeanDefinitionParser.parse(ConcurrentSessionsBeanDefinitionParser.java:64)
at org.springframework.security.config.HttpSecurityBeanDefinitionParser.registerConcurrentSessionControlBeansIfRequired(HttpSecurityBeanDefinitionParser.java:261)
at org.springframework.security.config.HttpSecurityBeanDefinitionParser.parse(HttpSecurityBeanDefinitionParser.java:147)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
at org.springframework.ide.eclipse.beans.core.internal.model.namespaces.DelegatingNamespaceHandlerResolver$ElementTrackingNamespaceHandler.parse(DelegatingNamespaceHandlerResolver.java:177)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1410)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$ErrorSuppressingBeanDefinitionParserDelegate.parseCustomElement(BeansConfig.java:1434)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1400)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:172)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$ToolingFriendlyBeanDefinitionDocumentReader.doRegisterBeanDefinitions(BeansConfig.java:1363)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$2.registerBeanDefinitions(BeansConfig.java:410)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$2.loadBeanDefinitions(BeansConfig.java:394)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$3.call(BeansConfig.java:453)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$3.call(BeansConfig.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
我的项目使用spring-security-core:2.0.8.RELEASE
和spring-core:3.2.0.RELEASE
,因此很明显我的项目使用的Spring版本与IDE用于分析bean的Spring版本不兼容。我试过了:
Project > Properties > Spring > Beans Support > Config Files > Remove above xml
)Project > Properties > Spring > Project Validators > Uncheck Beans Validator
)但他们都没有帮助。此错误导致:
有什么方法可以解决这个问题?
答案 0 :(得分:1)
不幸的是,看起来确实使用的库的版本与用于创建bean模型的IDE内部使用的Spring版本不兼容,因此从项目属性中删除有问题的Spring XML配置文件是正确的方法对于这个问题。
但看起来您的XML仍被用于创建内部bean模型。因此,请确保禁用自动配置文件检测机制,否则该机制会反复找到您的XML文件。