【问题标题】:SCD "x-schema::tns" didnt match any schema componentSCD“x-schema::tns”不匹配任何模式组件
【发布时间】:2016-02-05 12:00:20
【问题描述】:

我正在从 maven 任务运行 wsimport(使用 jaxws-maven-plugin

我的配置如下:

      <execution>
        <id>wsimport-first</id>
        <goals>
          <goal>wsimport</goal>
        </goals>
        <configuration>
          <wsdlLocation>WEB-INF/wsdl/FirstWebService.wsdl</wsdlLocation>
          <wsdlFiles>
            <wsdlFile>FirstWebService.wsdl</wsdlFile>
          </wsdlFiles>
          <bindingFiles>
            <bindingFile>global-bindings.xml</bindingFile>
            <bindingFile>first-ws-bindings.xml</bindingFile>
            <bindingFile>first-xs-bindings.xml</bindingFile>
          </bindingFiles>
        </configuration>
      </execution>

我收到以下错误:

[ERROR] SCD "x-schema::tns" didnt match any schema component
        at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:269)
  line 4 of file:/xxxxx/src/main/resources/WEB-INF/binding/first-xs-bindings.xml
        at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)

        at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:142)
        at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2298)
        at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:198)
        at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:141)
        at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:444)
        at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:205)
        at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.codehaus.mojo.jaxws.Invoker.main(Invoker.java:78)
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.codehaus.mojo.jaxws.Invoker.main(Invoker.java:78)
Caused by: com.sun.tools.ws.wscompile.AbortException
        at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:144)
        at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2298)
        at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:198)
        at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:141)
        at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:444)
        at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:205)
        at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
        ... 5 more

我的猜测是我的first-xs-bindings.xml 文件已损坏或无效...但我不知道如何调试它或从哪里开始。

【问题讨论】:

    标签: maven wsimport eclipse-scout jaxws-maven-plugin


    【解决方案1】:

    我发现我的配置有什么问题。

    在我的父 pom 层次结构中,其中一个父 pom 也在为 jaxws-maven-plugin 配置一些东西,并希望我设置一些属性。因此,我在这里介绍的配置没有任何问题。

    “SCD 引用”的问题来自损坏的配置(在父 pom 中定义)

    关于 SCD 参考,您可以阅读以下内容:How to make a JAX-WS client reuse existing classes for data binding

    【讨论】:

      【解决方案2】:

      我在尝试使用剧集时遇到了同样的问题。我有一组来自 jar 文件的模式,我必须从中扩展其中一个模式。 所以我的 pom 中有两个执行计划,如下所示。

               <plugin>
                      <groupId>org.jvnet.jaxb2.maven2</groupId>
                      <artifactId>maven-jaxb2-plugin</artifactId>
                      <executions>
                          <execution>
                              <id>JAXB Generation - canonical schemas</id>
                              <goals>
                                  <goal>generate</goal>
                              </goals>
                              <configuration>
                                  <id>JAXB Generation</id>
                                  <goals>
                                      <goal>generate</goal>
                                  </goals>
                                  <extension>true</extension>
                                  <args>
                                      <arg>-Xannotate</arg>
                                      <arg>-XtoString</arg>
                                      <arg>-enableIntrospection</arg>
                                      <arg>-extension</arg>
                                      <arg>-Xnamespace-prefix</arg>
                                      <arg>-XJsr303Annotations</arg>
                                      <arg>-XJsr303Annotations:notNullAnnotationsCustomMessages=ClassName</arg>
                                  </args>
                                  <schemaDirectory>${project.build.directory}/dependency</schemaDirectory>
                                  <bindingDirectory>${project.basedir}/src/main/bindings</bindingDirectory>
                                  <generateDirectory>${project.build.directory}/generated-sources/xjc</generateDirectory>
                                  <bindingIncludes>
                                      <include>RootElements-v1-binding.xjb</include>
                                      <include>global-binding.xjb</include>
                                  </bindingIncludes>
                                  <scanDependenciesForBindings>false</scanDependenciesForBindings>
                                  <schemaIncludes>
                                      <include>**/*.xsd</include>
                                  </schemaIncludes>
                                  <catalog>src/main/resources/catalog/catalog.cat</catalog>
                                  <plugins>
                                      <plugin>
                                          <groupId>org.jvnet.jaxb2_commons</groupId>
                                          <artifactId>jaxb2-basics</artifactId>
                                      </plugin>
                                      <plugin>
                                          <groupId>org.jvnet.jaxb2_commons</groupId>
                                          <artifactId>jaxb2-basics-annotate</artifactId>
                                      </plugin>
                                      <plugin>
                                          <groupId>com.github.krasa</groupId>
                                          <artifactId>krasa-jaxb-tools</artifactId>
                                          <version>1.4</version>
                                      </plugin>
                                  </plugins>
                              </configuration>
                          </execution> 
                          <execution>
                              <id>JAXB Generation - extended schema</id>
                              <goals>
                                  <goal>generate</goal>
                              </goals>
                              <configuration>
                                  <id>JAXB Generation</id>
                                  <goals>
                                      <goal>generate</goal>
                                  </goals>
                                  <extension>true</extension>
      
                                  <args>
                                      <arg>-Xannotate</arg>
                                      <arg>-XtoString</arg>
                                      <arg>-enableIntrospection</arg>
                                      <arg>-extension</arg>
                                      <arg>-Xnamespace-prefix</arg>
                                      <arg>-XJsr303Annotations</arg>
                                      <arg>-XJsr303Annotations:notNullAnnotationsCustomMessages=ClassName</arg>
                                  </args>
                                  <strict>false</strict>
                                  <schemaIncludes>
                                      <include>MyExtendedSchema_v1.xsd</include>
                                  </schemaIncludes>
                                  <generateDirectory>${project.build.directory}/extended/generated-sources/xjc</generateDirectory>
                                  <catalog>src/main/resources/catalog/catalog.cat</catalog>
                                  <episode>true</episode>
                                  <episodeFile>${project.build.directory}/generated-sources/xjc/META-INF/sun-jaxb.episode</episodeFile>
                                  <addIfExistsToEpisodeSchemaBindings>true</addIfExistsToEpisodeSchemaBindings>
                                  <episodes>
                                      <episode>
                                          <groupId>com.comp.domain</groupId>
                                          <artifactId>my-current-artifact-id</artifactId>
                                          <version>appropriate version</version>
                                      </episode>
                                  </episodes>
                                  <plugins>
                                      <plugin>
                                          <groupId>org.jvnet.jaxb2_commons</groupId>
                                          <artifactId>jaxb2-basics</artifactId>
                                      </plugin>
                                      <plugin>
                                          <groupId>org.jvnet.jaxb2_commons</groupId>
                                          <artifactId>jaxb2-basics-annotate</artifactId>
                                      </plugin>
                                      <plugin>
                                          <groupId>com.github.krasa</groupId>
                                          <artifactId>krasa-jaxb-tools</artifactId>
                                          <version>1.4</version>
                                      </plugin>
                                  </plugins>
                              </configuration>
                          </execution>
                      </executions>
                      <dependencies>
                          <dependency>
                              <groupId>org.jvnet.jaxb2_commons</groupId>
                              <artifactId>jaxb2-namespace-prefix</artifactId>
                              <version>1.1</version>
                          </dependency>
                      </dependencies>
                  </plugin>
      

      但是 XJC 一直在抱怨我 SCD "x-schema::tns" 与生成的剧集文件 sun-jaxb.episode 中的任何模式组件问题不匹配,该文件位于 target/generated-sources/xjc/META-INF。

       {<bindings scd="x-schema::tns" xmlns:tns="urn:com:corp:domain:entities:v1">
      

      我突出显示了我生成的剧集文件中的示例代码。

      我必须导入剧集文件中指定的所有命名空间/模式,不管我在扩展模式中并不真正需要它们。我知道这有点烦人,但看起来没有任何真正解决这个问题。

      尽管有一些链接说 addIfExistsToEpisodeSchemaBindings 配置将有助于解决问题,但这对我来说并没有真正起作用。 只是发布这个以防万一其他人遇到同样的问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-03-10
        • 2016-10-01
        • 2021-09-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多