[ 
https://issues.apache.org/jira/browse/CXF-8838?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17714346#comment-17714346
 ] 

Andriy Redko commented on CXF-8838:
-----------------------------------

[~marko.kocic] your bindings are incorrect. Apache CXF 4.0.0 is based on 
Jakarta EE 9 but your bindings are still using old Java EE namespaces, the 
right versions is below (please notice jaxb and jaxb namespaces):
{noformat}
<jaxb:bindings
    xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb";
    xmlns:jaxws="https://jakarta.ee/xml/ns/jaxws";
    xmlns:xs="http://www.w3.org/2001/XMLSchema"; version="3.0">
    <jaxb:bindings>
        <jaxb:globalBindings
            underscoreBinding="asCharInWord" />
    </jaxb:bindings>
    <jaxws:bindings node="wsdl:definitions"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
        <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
    </jaxws:bindings>
</jaxb:bindings>
 {noformat}
 

> Regression in cxf-codegen-plugin wsdl2java 4.0.0
> ------------------------------------------------
>
>                 Key: CXF-8838
>                 URL: https://issues.apache.org/jira/browse/CXF-8838
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 4.0.0
>            Reporter: Marko Kocic
>            Priority: Major
>             Fix For: 4.0.1
>
>         Attachments: test.zip
>
>
> When trying to generate Java source code using wsdl2java from 
> cxf-codegen-plugin 4.0.0, the generation fails if there are element names 
> that differs only in underscore `_` character.
>  
> Attached is the minimal [^test.zip] project that demonstrates the issue.
> In the attached wsdl file there are two elements that differ only in 
> underscore in the name:
> {code:java}
> <xsd:element name="LOGNO" type="tns:char20" />
> <xsd:element name="LOG_NO" type="tns:char20" /> {code}
> When run using the 4.0.0 version of the plugin, building gives the error "Two 
> declarations cause a collision in the ObjectFactory class.". Exeprpt from the 
> build log:
> {code:java}
> [WARNING] Exception in thread "main" 
> org.apache.cxf.tools.common.ToolException: 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
>  [896,16]: Two declarations cause a collision in the ObjectFactory class.
> [WARNING] 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
>  [919,16]: (Related to above error) This is the other declaration.
> [WARNING] 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
>  [878,16]: Two declarations cause a collision in the ObjectFactory class.
> [WARNING] 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
>  [1006,16]: (Related to above error) This is the other declaration.
> [WARNING] 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
>  [879,16]: Two declarations cause a collision in the ObjectFactory class.
> [WARNING] 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
>  [1007,16]: (Related to above error) This is the other declaration.
> [WARNING]
> [WARNING]       at 
> org.apache.cxf.tools.common.ToolErrorListener.throwToolException(ToolErrorListener.java:87)
> [WARNING]       at 
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:158)
> [WARNING]       at 
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:402)
> [WARNING]       at 
> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
> [WARNING]       at 
> org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
> [WARNING]       at 
> org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
> [WARNING]       at 
> org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java.main(ForkOnceWSDL2Java.java:51)
> [WARNING]       Suppressed: org.apache.cxf.tools.common.ToolException: 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
>  [896,16]: Two declarations cause a collision in the ObjectFactory class.
> [WARNING]               ... 7 more
> [WARNING]       Caused by: com.sun.istack.SAXParseException2publicId: 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl;
>  systemId: 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl;
>  lineNumber: 896; columnNumber: 16; Two declarations cause a collision in the 
> ObjectFactory class.
> [WARNING]               at 
> com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
> [WARNING]               at 
> com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:161)
> [WARNING]               at 
> com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate(PublicObjectFactoryGenerator.java:29)
> [WARNING]               at 
> com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:242)
> [WARNING]               at 
> com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:141)
> [WARNING]               at 
> com.sun.tools.xjc.model.Model.generateCode(Model.java:258)
> [WARNING]               at 
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:255)
> [WARNING]               at 
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:67)
> [WARNING]               at 
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:445)
> [WARNING]               at 
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:711)
> [WARNING]               at 
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:259)
> [WARNING]               at 
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:156)
> [WARNING]               ... 5 more
> [WARNING]       Suppressed: org.apache.cxf.tools.common.ToolException: 
> file:/C:/src/is/wso2/AS/Libraries/TSS.IA.S4.Library/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl
>  [919,16]: (Related to above error) This is the other declaration.
> [WARNING]               ... 7 more {code}
> When using the cxf-codegen-plugin version 3.5.5, code is generated properly:
> {code:java}
> @XmlElement(name = "LOGNO", required = true)    protected String logno;
> @XmlElement(name = "LOG_NO", required = true)    protected String log_NO; 
> {code}
> I tried playing with different options, specifying different parameters, but 
> to no avail, I always get the error above.
> This is a blocker for me, since I can't use 3.5.5 version in 4.0.0 based 
> project, since it generates code in the old javax instead jakarta namespace.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to