Java cvc complex type.2.4.c:匹配的通配符是严格的,但是找不到元素';jaxws:inInterceptors&x27;

Java cvc complex type.2.4.c:匹配的通配符是严格的,但是找不到元素';jaxws:inInterceptors&x27;,java,xml,spring,maven,pom.xml,Java,Xml,Spring,Maven,Pom.xml,我正在Java EE Luna中使用Maven,并试图在安装Maven来构建和测试我构建的web服务之前修复beans.xml中的错误。我的代码中有一个错误,它说“cvc complex type.2.4.c:匹配的通配符是严格的,但是找不到元素‘jaxws:inInterceptors’的声明。”。我的beans.xml文件中的错误行如下所示: <jaxws:inInterceptors> 我尝试在网上搜索,建议将依赖关系相关的JAWX添加到我的pom.xml文件中,但它不起

我正在Java EE Luna中使用Maven,并试图在安装Maven来构建和测试我构建的web服务之前修复beans.xml中的错误。我的代码中有一个错误,它说“cvc complex type.2.4.c:匹配的通配符是严格的,但是找不到元素‘jaxws:inInterceptors’的声明。”。我的beans.xml文件中的错误行如下所示:

<jaxws:inInterceptors>

我尝试在网上搜索,建议将依赖关系相关的JAWX添加到我的pom.xml文件中,但它不起作用,所以我想知道我的xml代码出了什么问题

这是my beans.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:jaxws="http://cxf.apache.org/jaxws"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

        <import resource="classpath:META-INF/cxf/cxf.xml" />

        <!-- Spring's component scan for identifying beans to be managed by the container. -->
        <context:component-scan base-package="au.edu.unsw.soacourse.addressing"/>

        <jaxws:endpoint 
          id="GNAFAddressingService" 
          implementor="au.edu.unsw.soacourse.addressing.GNAFAddressingService" 
          address="/GNAFAddressingServiceImpl" />


          <jaxws:inInterceptors>
            <ref bean="GNAFAddressingServiceSOAPInterceptor" />
          </jaxws:inInterceptors>


        <bean id="GNAFAddressingServiceSOAPInterceptor" class="au.edu.unsw.soacourse.addressing.GNAFAddressingServiceSOAPInterceptor" />  

</beans>

这是my pom.xml中的代码:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>au.edu.unsw.soacourse</groupId>
    <artifactId>GNAFAddressingService</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>Simple CXF Java-first SOAP project using Spring configuration</name>
    <description>Simple CXF Java-first SOAP project using Spring configuration</description>
    <dependencies>
        <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-rs-extension-providers</artifactId>
            <version>${cxf.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.8.11.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>3.0.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>3.0.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <!-- comp9322: adding a Maven plug-in from Apache CXF 
        for code generation (cxf-codegen-plugin). This plug-in
        runs WSDL2Java which is the actual tool that generates
        code from WSDL. This plug-in will run as a new goal 
        'generate-sources', which means you can also execute it 
        using 'mvn generate-sources' in the command line, or from 
        Run As -> Maven -> mvn generate-sources.
        -->
        <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>3.0.4</version>
                <executions>
                  <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                  <configuration>
                      <sourceRoot>src/main/java-generated</sourceRoot>
                      <wsdlOptions>
                          <wsdlOption>
                              <wsdl>${basedir}/src/main/resources/wsdl/GNAFAddressingService.wsdl</wsdl>
                          </wsdlOption>
                      </wsdlOptions>
                  </configuration>
                  <goals>
                      <goal>wsdl2java</goal>
                  </goals>
                  </execution>
                </executions>
            </plugin> 
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <!-- mvn clean install tomcat:run-war to deploy
                    Look for "Running war on http://xxx" and
                    "Setting the server's publish address to be /yyy"
                    in console output; WSDL browser address will be
                    concatenation of the two: http://xxx/yyy?wsdl
                    -->
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <version>2.0</version>
                    <executions>
                        <execution>
                            <id>start-tomcat</id>
                            <goals>
                                <goal>run-war</goal>
                            </goals>
                            <phase>pre-integration-test</phase>
                            <configuration>
                                <port>${test.server.port}</port>
                                <path>/webservice</path>
                                <fork>true</fork>
                                <useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <!-- comp9322: maven-compiler-plugin part 
                        referencing JDK 1.7 instead of default 1.6
                        -->
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <configuration>
                        <projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
                        <wtpmanifest>true</wtpmanifest>
                        <wtpapplicationxml>true</wtpapplicationxml>
                        <wtpversion>2.0</wtpversion>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

4.0.0
au.edu.unsw.soacourse
GNAFAddressingService
1.0-快照
战争
使用Spring配置的简单CXF Java第一个SOAP项目
使用Spring配置的简单CXF Java第一个SOAP项目
org.apache.cxf
cxf rt绑定soap
${cxf.version}
编译
org.apache.cxf
cxf rt rs扩展提供程序
${cxf.version}
编译
org.xerial
sqlite jdbc
3.8.11.2
org.apache.cxf
cxf rt前端jaxws
3.0.5
编译
org.apache.cxf
cxf rt传输http
3.0.5
编译
org.springframework
弹簧网
3.2.6.1发布
朱尼特
朱尼特
4.12
测试
org.apache.cxf
cxf-codegen插件
3.0.4
生成源
生成源
src/main/java生成
${basedir}/src/main/resources/wsdl/GNAFAddressingService.wsdl
wsdl2java
org.apache.tomcat.maven
tomcat7 maven插件
2
启动雄猫
打仗
预集成测试
${test.server.port}
/网络服务
真的
真的
org.apache.maven.plugins
maven编译器插件
1.7
1.7
org.apache.maven.plugins
maven eclipse插件
[工件ID]-[版本]
真的
真的
2

在您的代码中,xsi:schemaLocation=“”后面有空格和新行。请尝试删除它,并将第一个值放在同一行

改变

xsi:schemaLocation="
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd
为此:

xsi:schemaLocation="http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd