我正在从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
文件已损坏或无效......但我不知道如何调试它或我可以从哪里开始。
答案 0 :(得分:1)
我发现我的配置出了什么问题。
在我的父pom层次结构中,其中一个父pom也为int widths[101] = { 1 };
widths[10] = 2;
widths[100] = 3;
配置了一些内容,并期望我设置一些属性。因此,我在此处提供的配置没有任何问题。
“SCD引用”的问题来自破坏的配置(在父pom中定义)
关于SCD参考资料,您可以阅读:How to make a JAX-WS client reuse existing classes for data binding
答案 1 :(得分:0)
当我尝试使用剧集时,我遇到了同样的问题。我从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&#34; x-schema :: tns&#34;没有匹配生成的剧集文件sun-jaxb.episode中的任何架构组件问题,该文件位于target / generated-sources / xjc / META-INF中。
{<bindings scd="x-schema::tns" xmlns:tns="urn:com:corp:domain:entities:v1">
我突出显示了我生成的剧集文件中的示例代码。
我必须导入剧集文件中指定的所有名称空间/模式,不管我在扩展模式中是否真的需要它们。我知道这有点烦人但看起来有点没有任何真正的解决方法。
即使有一些链接说addIfExistsToEpisodeSchemaBindings配置将有助于解决问题,但这对我没有用。 如果其他人正在努力解决同样的问题,请发布此内容。