NoSuchMethodError when generating code for soap client via Apache CXF 2.x
<p>When I generate the required classes for a SOAP client, via Apache CXF 2.x WSDL2Java I get this exception. Any help is much appreciated. Thanks!</p>

<blockquote>
  <p>Exception in thread "main" java.lang.NoSuchMethodError: com.sun.xml.bind.v2.util.XmlFactory.allowExternalAccess(Ljavax/xml/validation/SchemaFactory;Ljava/lang/String;Z)Ljavax/xml/validation/SchemaFactory;
      at com.sun.tools.xjc.reader.internalizer.DOMForest.weakSchemaCorrectnessCheck(DOMForest.java:478)
      at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:260)
      at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)
      at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:460)
      at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:727)
      at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:271)
      at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:165)
      at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:416)
      at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
      at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
      at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
      at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)</p>
</blockquote>

<p><strong>WSDL</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;wsdl:definitions 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:tns="http://www.example.org/Calculator/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
name="Calculator" 
targetNamespace="http://www.example.org/Calculator/"&gt;
  &lt;wsdl:types&gt;
    &lt;xsd:schema targetNamespace="http://www.example.org/Calculator/"&gt;
      &lt;xsd:element name="Add"&gt;
        &lt;xsd:complexType&gt;
          &lt;xsd:sequence&gt;
            &lt;xsd:element minOccurs="0" name="a" type="xsd:int" /&gt;
            &lt;xsd:element minOccurs="0" name="b" type="xsd:int" /&gt;
          &lt;/xsd:sequence&gt;
        &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
      &lt;xsd:element name="AddResponse"&gt;
        &lt;xsd:complexType&gt;
          &lt;xsd:sequence&gt;
            &lt;xsd:element minOccurs="0" name="result" type="xsd:int" /&gt;
          &lt;/xsd:sequence&gt;
        &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
      &lt;xsd:element name="Subtract"&gt;
        &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
                &lt;xsd:element minOccurs="0" name="a" type="xsd:int" /&gt;
                &lt;xsd:element minOccurs="0" name="b" type="xsd:int" /&gt;
            &lt;/xsd:sequence&gt;
        &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
      &lt;xsd:element name="SubtractResponse"&gt;
        &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
                &lt;xsd:element minOccurs="0" name="result" type="xsd:int" /&gt;
            &lt;/xsd:sequence&gt;
        &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
    &lt;/xsd:schema&gt;
  &lt;/wsdl:types&gt;
  &lt;wsdl:message name="AddRequest"&gt;
    &lt;wsdl:part element="tns:Add" name="parameters"/&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="AddResponse"&gt;
    &lt;wsdl:part element="tns:AddResponse" name="parameters"/&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="SubtractRequest"&gt;
    &lt;wsdl:part name="parameters" element="tns:Subtract"&gt;&lt;/wsdl:part&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="SubtractResponse"&gt;
    &lt;wsdl:part name="parameters" element="tns:SubtractResponse"&gt;&lt;/wsdl:part&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:portType name="Calculator"&gt;
    &lt;wsdl:operation name="Add"&gt;
      &lt;wsdl:input message="tns:AddRequest"/&gt;
      &lt;wsdl:output message="tns:AddResponse"/&gt;
    &lt;/wsdl:operation&gt;
    &lt;wsdl:operation name="Subtract"&gt;
        &lt;wsdl:input message="tns:SubtractRequest"&gt;&lt;/wsdl:input&gt;
        &lt;wsdl:output message="tns:SubtractResponse"&gt;&lt;/wsdl:output&gt;
    &lt;/wsdl:operation&gt;
  &lt;/wsdl:portType&gt;
  &lt;wsdl:binding name="CalculatorSoapBinding" type="tns:Calculator"&gt;
    &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
    &lt;wsdl:operation name="Add"&gt;
      &lt;soap:operation soapAction="http://www.example.org/Calculator/Add"/&gt;
      &lt;wsdl:input&gt;
        &lt;soap:body use="literal"/&gt;
      &lt;/wsdl:input&gt;
      &lt;wsdl:output&gt;
        &lt;soap:body use="literal"/&gt;
      &lt;/wsdl:output&gt;
    &lt;/wsdl:operation&gt;
    &lt;wsdl:operation name="Subtract"&gt;
      &lt;soap:operation soapAction="http://www.example.org/Calculator/Subtract"/&gt;
      &lt;wsdl:input&gt;
        &lt;soap:body use="literal"/&gt;
      &lt;/wsdl:input&gt;
      &lt;wsdl:output&gt;
        &lt;soap:body use="literal"/&gt;
      &lt;/wsdl:output&gt;
    &lt;/wsdl:operation&gt;
  &lt;/wsdl:binding&gt;
  &lt;wsdl:service name="CalculatorService"&gt;
    &lt;wsdl:port binding="tns:CalculatorSoapBinding" name="CalculatorSoapPort"&gt;
      &lt;soap:address location="http://www.example.org/Calculator"/&gt;
    &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
&lt;/wsdl:definitions&gt;
</code></pre>