2

I am running wsimport from a maven task (using the jaxws-maven-plugin)

My configuration looks like this:

      <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>

And I get following error:

[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

My guess is that my first-xs-bindings.xml File is broken or invalid... But I have no idea how I can debug it or where I can start.

Jmini
  • 9,189
  • 2
  • 55
  • 77

2 Answers2

1

I have found what was wrong with my configuration.

In my parent pom hierarchy, one of the parent pom was also configuring something for the jaxws-maven-plugin and was expecting me to set some properties. Therefore nothing was wrong in the configuration I have presented here.

The problem with "SCD references" was coming from the broken config (defined in the parent pom)

About SCD references you can read this: How to make a JAX-WS client reuse existing classes for data binding

Jmini
  • 9,189
  • 2
  • 55
  • 77
0

I got the same issue when i was trying to use episodes. I had set of schemas from a jar file and I have to extend one of the schema from it. So i had two execution plans in my pom like below.

         <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>

But XJC was keep complaining me with SCD "x-schema::tns" didnt match any schema component issue from the generated episode file sun-jaxb.episode which lies in target/generated-sources/xjc/META-INF.

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

I highlighted the sample code from my generated episode file.

I had to import all the namespaces/schemas which are specified in the episode file, no matter that I didn't really need all of them in my extended schema.I know this was bit annoying but looks like there is no any real work around for this.

Even though there are some links which says addIfExistsToEpisodeSchemaBindings configuration will help to fix the issue, but that didnt really worked for me. Just posting this in case if some one else is struggling with the same issue.

Seetha
  • 980
  • 1
  • 8
  • 27