CXF wsdl2java - undefined element declaration 's:schema' - PluginExecutionException

Recently I got a third party generated wsdl, and when I try to use wsdl2java cxf-codegen-plugin in maven eclipse it shows the below error in the wsdl:

undefined element declaration 's:schema' (org.apache.cxf:cxf-codegen-plugin:3.1.7:wsdl2java:generate-sources:generate-sources)

After some googling it seems to be a common issue with JAXB and .NET WSDL.

Here is the problematic part of the WSDL:
 <s:element minOccurs="0" maxOccurs="1" name="GetQuoteDataSetResult">  
  <s:complexType>  
   <s:sequence>  
    <s:element ref="s:schema"/>  
    <s:any/>  
   </s:sequence>  
  </s:complexType>  
 </s:element>  

The easier solution seems to be to download the WSDL and modify the schema in order to generate the stub. Here is what I did to the WSDL as per the suggestion:
 <s:element minOccurs="0" maxOccurs="1" name="GetQuoteDataSetResult">  
        <s:complexType>  
         <s:sequence>  
          <!-- s:element ref="s:schema" /-->  
          <s:any minOccurs="2" />  
         </s:sequence>  
        </s:complexType>  
 </s:element>  

After the change the maven plugin ran successfully to generate the Java code.

Ref: http://cxf.547215.n5.nabble.com/Thrown-by-JAXB-undefined-element-declaration-s-schema-td554126.html

1 comment: