java 无法为 Spring Web 服务的元素找到 BeanDefinitionParser
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15394118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot locate BeanDefinitionParser for element for Spring web services
提问by lancex
I am brand new to Spring web services and I keep getting this error:
我是 Spring Web 服务的新手,我不断收到此错误:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [annotation-driven]
Offending resource: ServletContext resource [/WEB-INF/spring-ws-servlet.xml]
After some digging around, it looks like I most likely have a version mismatch between my schemas and jars but I do not see where (I'm shooting for v3.1).
经过一番挖掘,看起来我的模式和罐子之间很可能存在版本不匹配,但我看不到哪里(我正在为 v3.1 拍摄)。
Here is every Springjar in my library:
这是我图书馆中的每个Springjar:
M2_REPO\org\springframework\spring-aop.1.1.RELEASE\spring-aop-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-asm.1.1.RELEASE\spring-asm-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-beans.1.1.RELEASE\spring-beans-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-context.1.1.RELEASE\spring-context-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-context-support.1.1.RELEASE\spring-context-support-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-core.1.1.RELEASE\spring-core-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-expression.1.1.RELEASE\spring-expression-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-jdbc.1.1.RELEASE\spring-jdbc-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-jms.1.1.RELEASE\spring-jms-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-oxm.1.1.RELEASE\spring-oxm-3.1.1.RELEASE.jar
M2_REPO\org\springframework\ws\spring-oxm.5.10\spring-oxm-1.5.10.jar
M2_REPO\org\springframework\ws\spring-oxm-tiger.5.10\spring-oxm-tiger-1.5.10.jar
M2_REPO\org\springframework\security\spring-security-acl.1.1.RELEASE\spring-security-acl-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-config.1.1.RELEASE\spring-security-config-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-core.1.1.RELEASE\spring-security-core-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-remoting.1.1.RELEASE\spring-security-remoting-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-taglibs.1.1.RELEASE\spring-security-taglibs-3.1.1.RELEASE.jar
M2_REPO\org\springframework\security\spring-security-web.1.1.RELEASE\spring-security-web-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-test.1.1.RELEASE\spring-test-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-tx.1.1.RELEASE\spring-tx-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-web.1.1.RELEASE\spring-web-3.1.1.RELEASE.jar
M2_REPO\org\springframework\spring-webmvc.1.1.RELEASE\spring-webmvc-3.1.1.RELEASE.jar
M2_REPO\org\springframework\ws\spring-ws-core.1.2.RELEASE\spring-ws-core-2.1.2.RELEASE.jar
M2_REPO\org\springframework\ws\spring-ws-core-tiger.5.10\spring-ws-core-tiger-1.5.10.jar
M2_REPO\org\springframework\ws\spring-xml.5.10\spring-xml-1.5.10.jar
spring-ws-servlet.xml
spring-ws-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="my.package"/>
<sws:annotation-driven />
<sws:dynamic-wsdl id="MyService"
portTypeName="MyServiceInterface"
locationUri="/myService/">
<sws:xsd location="/WEB-INF/mySchema.xsd" />
</sws:dynamic-wsdl>
</beans>
web.xml
网页.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>
My Webservice Created By Archetype for Spring WS
</display-name>
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>spring-ws</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
applicationContext.xmlI'm not sure that I even need this...
applicationContext.xml我不确定我什至需要这个......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="my.package" />
<context:annotation-config />
</beans>
The error is being thrown in spring-ws-servlet.xml whenever it reads a element. Like I said, I'm brand new to Spring web services and recognize that there is probably an obvious flaw in my setup and would greatly appreciate any help. Thanks!
每当它读取一个元素时,就会在 spring-ws-servlet.xml 中抛出错误。就像我说的,我是 Spring Web 服务的新手,并且认识到我的设置中可能存在明显的缺陷,非常感谢任何帮助。谢谢!
采纳答案by lancex
Solved. Apparently one of my dependencies was bringing in a different version of spring-ws even though it wasn't listed under my referenced libraries. I actually ended up not needing the whole dependency so I simply removed it and now I'm not getting any errors.
解决了。显然,我的一个依赖项是引入了不同版本的 spring-ws,即使它没有列在我引用的库下。我实际上最终不需要整个依赖项,所以我只是删除了它,现在我没有收到任何错误。