You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by blicket <ma...@gmail.com> on 2011/11/21 14:59:11 UTC

WSDLToJava Error: ...is already defined at...

I'm using the wsdl2java tool to generate all.  The problem is that there is
no where else where this type is already defined.   If I comment out the
definition, then it complains it's not defined.  I'm using a common schema
style for the most part.  THank you.

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

Re: WSDLToJava Error: ...is already defined at...

Posted by Paul Baker <pb...@mindspring.com>.
https://issues.apache.org/jira/browse/CXF-3968

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

Re: WSDLToJava Error: ...is already defined at...

Posted by Daniel Kulp <dk...@apache.org>.
Any chance you could distill this down into a small testcase and attach it to 
a JIRA?

Thanks!
Dan


On Thursday, December 08, 2011 2:42:11 AM Paul Baker wrote:
> 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-tp50
> 10580p5058342.html Sent from the cxf-user mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: WSDLToJava Error: ...is already defined at...

Posted by Paul Baker <pb...@mindspring.com>.
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.

Re: WSDLToJava Error: ...is already defined at...

Posted by blicket <ma...@gmail.com>.
I'll try to upload an example by tomorrow.  I have to scrub it first.

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

Re: WSDLToJava Error: ...is already defined at...

Posted by blicket <ma...@gmail.com>.
CXF-3927 was just created.  Please take a look.  Thanks.

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

Re: WSDLToJava Error: ...is already defined at...

Posted by blicket <ma...@gmail.com>.
I just tried using 2.5.0, no luck.  Just the same (single) message:

WSDLToJava Error: Thrown by JAXB: 'TestAcknowledgements' is already defined
at line 43 column 14 of schema file:....

The following is with the -verbose option:

        at
rg.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBBindErrorListener.error(JAXBBindErrorListener.java:35)
        at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.error(SchemaCompilerImpl.java:286)
        at
com.sun.tools.xjc.util.ErrorReceiverFilter.error(ErrorReceiverFilter.java:77)
        at
com.sun.xml.xsom.impl.parser.ParserContext$2.error(ParserContext.java:202)
        at
com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:180)
        at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:170)
        at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:173)
        at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.checkDoubleDefError(NGCCRuntimeEx.java:145)
        at com.sun.xml.xsom.impl.parser.state.Schema.action5(Schema.java:88)
        at
com.sun.xml.xsom.impl.parser.state.Schema.onChildCompleted(Schema.java:1248)
        at
com.sun.xml.xsom.impl.parser.state.NGCCHandler.revertToParentFromText(NGCCHandler.java:144)
        at
com.sun.xml.xsom.impl.parser.state.complexType.text(complexType.java:1600)
        at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.processPendingText(NGCCRuntime.java:197)
        at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.endElement(NGCCRuntime.java:273)
        at
org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
        at
com.sun.tools.xjc.util.SubtreeCutter.endElement(SubtreeCutter.java:108)
        at
org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
        at
org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
        at
com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.endElement(CustomizationContextChecker.java:194)
        at
org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2939)
        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
        at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
        at com.sun.xml.xsom.parser.JAXPParser.parse(JAXPParser.java:115)
        at
com.sun.tools.xjc.reader.internalizer.DOMForestParser.parse(DOMForestParser.java:95)
        at
com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:262)
        at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:337)
        at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.includeSchema(NGCCRuntimeEx.java:234)
        at
com.sun.xml.xsom.impl.parser.state.includeDecl.action0(includeDecl.java:43)
        at
com.sun.xml.xsom.impl.parser.state.includeDecl.leaveElement(includeDecl.java:132)
        at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.endElement(NGCCRuntime.java:275)
        at
org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
        at
com.sun.tools.xjc.util.SubtreeCutter.endElement(SubtreeCutter.java:108)
        at
org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
        at
org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
        at
com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.endElement(CustomizationContextChecker.java:194)
        at
org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
        at
com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.endElement(DOMForestScanner.java:135)
        at
com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:250)
        at
com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:276)
        at
com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:245)
        at
com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:122)
        at
com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:89)
        at
com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:97)
        at
com.sun.tools.xjc.reader.internalizer.DOMForestParser.parse(DOMForestParser.java:99)
        at
com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:262)
        at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:337)
        at
com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:124)
        at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:183)
        at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:172)
        at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:516)
        at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:236)
        at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:85)
        at
org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:393)
        at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:588)
        at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:240)
        at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:138)
        at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:283)
        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)
Caused by: org.xml.sax.SAXParseException: 'TestAcknowledgements' is already
defined
        at
com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:176)
        ... 66 more


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

Re: WSDLToJava Error: ...is already defined at...

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, November 21, 2011 5:59:11 AM blicket wrote:
> I'm using the wsdl2java tool to generate all.  The problem is that there is
> no where else where this type is already defined.   If I comment out the
> definition, then it complains it's not defined.  I'm using a common schema
> style for the most part.  THank you. 

We'd likely need to see the WSDL.   

Also, if you aren't using CXF 2.5.0, definitely try with it.  As part of 
CXF-3887 which is fixed in 2.5.0, I updated the XJC calls to allow JAXB to 
report multiple errors which MAY provide more information about this.  In some 
cases which JAXB reports a duplicate, it would send an error like above in one 
error message, but then immediately follow it with a second error message 
about where the duplicate is located.   That second error message was not 
picked up, but in this case could be valuable information.

Dan




> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/WSDLToJava-Error-is-already-defined-at-tp50
> 10580p5010580.html Sent from the cxf-user mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com