解析器错误cxf-beans.xml没有为元素'jaxws:endpoint'找到声明

时间:2013-06-25 14:16:43

标签: maven cxf m2e

<?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:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint xmlns:tns="http://sampleService.viasat.com/"
id="sampleserviceinterfcae" implementor="com.viasat.sampleservice.SampleServiceInterfcaeImpl"
    wsdlLocation="wsdl/sampleserviceimplementation.wsdl" endpointName="tns:SampleServiceImplementationPort"
    serviceName="tns:SampleServiceImplementationService" address="/SampleServiceImplementationPort">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
</jaxws:endpoint>
</beans>

我正在使用Maven构建应用程序。在mvn clean和mvn install之后,我在Tomcat中部署应用程序,之后我收到以下错误'来自ServletContext资源[/WEB-INF/classes/cxf-beans.xml]的XML文档中的第11行无效;嵌套异常是org.xml.sax.SAXParseException:cvc-complex-type.2.4.c:匹配的通配符是strict,但是找不到元素'jaxws:endpoint'的声明。'

1 个答案:

答案 0 :(得分:7)

您的弹簧配置看起来不错。因此,我能想到的唯一原因是您在类路径中缺少其中一个依赖项(很可能是cxf-rt-frontend-jaxws):

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-bindings-soap</artifactId>
    <version>${cxf.version}</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-transports-http</artifactId>
    <version>${cxf.version}</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>${cxf.version}</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-rs-extension-providers</artifactId>
    <version>${cxf.version}</version>
    <scope>compile</scope>
</dependency>

确保您在pom.xml中拥有它们,它应该有效。