I am receiving the same type of error when generating the client stubs.  No
errors are generated when generating the service stubs.  The problem appears
to be associated with duplicate xsd includes AND the wsdl location.

Client errors generated (only when the wsdl includes a xsd that is nested in
another xsd AND when the wsdl is referenced using an URL). 

Errors:

[INFO] --- cxf-codegen-plugin:2.5.0:wsdl2java (generate-sources) @
myserviceclient ---
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 7.810s
[INFO] Finished at: Thu Dec 08 05:11:20 EST 2011
[INFO] Final Memory: 39M/700M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.cxf:cxf-codegen-plugin:2.5.0:wsdl2java (generate-sources) on
project ahm565: Thrown by JAXB:
[ERROR] Thrown by JAXB:
[ERROR] Thrown by JAXB: 'applicationException' is already defined
[ERROR] 
[ERROR] Thrown by JAXB: (related to above error) the first definition
appears here
[ERROR] 
[ERROR] Thrown by JAXB: 'concurrentUpdateException' is already defined
...

The service stubs are generated from a wsdl stored with the project.
The client stubs are generated from a deployed wsdl.

I am using maven for both the service and client generation

<plugin>
  <groupId>org.apache.cxf</groupId>
   <artifactId>cxf-codegen-plugin</artifactId>
   <version>2.5.0</version>
      <executions>
        <execution>
          <id>generate-sources</id>
          <phase>generate-sources</phase>
          <configuration>
            <sourceRoot>${project.basedir}/src/main/java</sourceRoot>
              <wsdlOptions>
                <wsdlOption>
                   
<wsdl>${project.basedir}/WebContent/WEB-INF/wsdl/myservicer/MyService.wsdl</wsdl>
                </wsdlOption>
        </wsdlOptions>
          </configuration>
          <goals>
             <goal>wsdl2java</goal>
           </goals>
        </execution>
     </executions>

     <dependencies>
     </dependencies>
     <inherited>true</inherited>
</plugin>


In the client maven pom everything is the same except the location of the
wsdl:
<wsdl>http://localhost:8080/MyService?wsdl</wsdl>

The wsdl includes two xsds:

<wsdl:types>
  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
     <xsd:import
        namespace="http://www.widget.com/service/myservice/jaxb/to/";
        schemaLocation="../../xsd/myservice/MyService.xsd" />
     <xsd:import namespace="http://www.widget.com/service/common/jaxb/to/";
        schemaLocation="../../xsd/common/Common.xsd" />
   </xsd:schema>
</wsdl:types>

The MyService.xsd also includes Common.xsd.

If I remove Common.xsd from the wsdl file then all code is generated with no
errors... But, when the wsdl is displayed in Eclipse with the wsdl editor
then errors are displayed.






--
View this message in context: 
http://cxf.547215.n5.nabble.com/WSDLToJava-Error-is-already-defined-at-tp5010580p5058342.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to