You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marko Kocic <Ma...@trelleborg.com> on 2023/02/08 15:02:24 UTC

Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

I already reported the same before subscribing to the mailing list, and now after, hope it won't result in duplicate posts.

Hi everyone,

I am using cxf for a few years, always keeping it up to date, and now in the process of migrating to 4.0.0 and jakarta packages.
I got stuck with what I think is the regression in cxf-codegen-plugin.

I have a wsdl file that contain multiple elements which name differs only in underscore, e.g:

<xsd:element name="MIN_LOT_SIZE" type="tns:quantum13.3" />
<xsd:element name="MINLOTSIZE" type="tns:quantum13.3" />

To avoid clashes, in previous cxf-codegen-plugin versions we added a bindings.xml file like this:

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"<http://java.sun.com/xml/ns/jaxb%22> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"<http://java.sun.com/xml/ns/jaxws%22> xmlns:xs="http://www.w3.org/2001/XMLSchema"<http://www.w3.org/2001/XMLSchema%22> version="1.0">
  <jaxb:bindings>
    <jaxb:globalBindings
      underscoreBinding="asCharInWord" />
    </jaxb:bindings>
  <jaxws:bindings node="wsdl:definitions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"<http://schemas.xmlsoap.org/wsdl/%22>>
    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
  </jaxws:bindings>
</jaxb:bindings>

And added it like this to cxf-codegen-plugin invocation:
<plugin>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-codegen-plugin</artifactId>
  <executions>
    <execution>
      <id>generate-sources</id>
      <phase>generate-sources</phase>
      <configuration>
        <args>
          <arg>-B-XautoNameResolution</arg>
        </args>
        <sourceRoot>${basedir}/target/generated/cxf</sourceRoot>
        <wsdlOptions>
          <wsdlOption>
            <wsdl>${basedir}/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdl>
            <wsdlLocation>classpath:wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdlLocation>
            <packagenames>
              <packagename>urn:sap-com:document:sap:rfc:functions=com.project.s4.getMaterialAll
            </packagename>
          </packagenames>
          <bindingFiles>
            <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
          </bindingFiles>
        </wsdlOption>
      </wsdlOptions>
      <goals>
        <goal>wsdl2java</goal>
      </goals>
    </execution>
    </executions>
</plugin>

This approach worked fine until we upgraded to the latest cxf-codegen-plugin version 4.0.0. Now I get the following warnings and an error when running the goal:

[INFO] --- cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) @ TSS.IA.S4.Library ---
[INFO] Running code generation in fork mode...
[INFO] The java executable is C:\opt\jdk\bin\java.exe
[INFO] Building jar: C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar
[INFO] 11:42:22.873 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
[INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.3
[INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties
[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
[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: 919; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [878,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: 878; 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 [1006,16]: (Related to above error) This is the other declaration.
[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: 1006; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [879,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: 879; 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 [1007,16]: (Related to above error) This is the other declaration.
[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: 1007; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.826 s
[INFO] Finished at: 2023-02-08T11:42:24+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) on project TSS.IA.S4.Library:
[ERROR] Exit code: 1
[ERROR] Command line was: cmd.exe /X /C "C:\opt\jdk\bin\java.exe --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -Dorg.apache.cxf.Logger=null -jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-w2j11803512441830701137args"

Does anyone eles has the same issue with the latest cxf-codegen-plugin wsdl2java task, or I missed something during the upgrade?

Returning back to the old cxf-codegen-plugin is not an option, since it generates code in javax instead of Jakarta packages.

Best regards,
Marko




RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Posted by Marko Kocic <Ma...@trelleborg.com>.
Hi Colm,

I just filled bug report at https://issues.apache.org/jira/browse/CXF-8838

Thanks for approving my Jira account.

Cheers,
Marko

-----Original Message-----
From: Colm O hEigeartaigh <co...@apache.org>
Sent: Dienstag, 18. April 2023 17:10
To: users@cxf.apache.org
Subject: Re: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

[You don't often get email from coheigea@apache.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Hi Marko,

Did you request to create an account in JIRA so that you can create the ticket? https://selfserve.apache.org/jira-account.html

Colm.

On Tue, Apr 18, 2023 at 3:19 PM Marko Kocic <Ma...@trelleborg.com> wrote:
>
> Hi everyone,
>
> I can't find this issue reported in CXF Jira. Since it's not public, can someone with the access to bug tracker report this as a regression bug in cxf-codegen-plugin 4.0.0 ?
>
> Cheers,
> Marko
>
> -----Original Message-----
> From: Marko Kocic <Ma...@trelleborg.com>
> Sent: Montag, 13. Februar 2023 12:22
> To: users@cxf.apache.org
> Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0
>
> Hi,
>
> The attachment in previous mail is just a stripped down minimal example that ilustrates the issue with the new cxf-codegen plugin 4.0.0.
>
> The real wsdl file is huge and changes relatively frequently, and we have many such files in a project, so it's not feasible to edit them manually every time.
>
> The old cxf-codegen-plugin 3.5.5 and earlier didn't have issue with duplicate names, they would generate properties like this by default:
>
>     @XmlElement(name = "LOGNO", required = true)
>     protected String logno;
>     @XmlElement(name = "LOG_NO", required = true)
>     protected String log_NO;
>
> It's the new cxf-codegen-plugin 4.0.0 that fails with errors about duplicate names. Something got broken in this release in this regard.
> If you look at the attached project, we even tried providing bindings configuration which should explicitly force proper handling of underscore character, but it looks like it get's ignored: underscoreBinding="asCharInWord"
>
> If the old cxf-codegen-plugin were able to generate java code using Jakarta namespace, we could still use it, but since we want to switch to the cxf-4.0.0, that uses Jakarta namespaces, we had to use cxf-codegen-plugin 4.0.0 which is broken in this regard.
>
> Cheers,
> Marko
>
> -----Original Message-----
> From: Lulseged Zerfu <zl...@hotmail.com>
> Sent: Samstag, 11. Februar 2023 11:22
> To: users@cxf.apache.org
> Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0
>
> Hi
>
> You need to customize because these 2 elements will get same class name:
>
> <xsd:element name="LOGNO" type="tns:char20"/> <xsd:element
> name="LOG_NO" type="tns:char20"/>
>
> May be you can instead put like:
>
> <xsd:element name="LOGNO" type="tns:char20" maxOccurs="2"/>
>
> BR
> Lulseged
>
> From: Marko Kocic <Ma...@trelleborg.com>
> Sent: Thursday, 9 February 2023 16:24
> To: users@cxf.apache.org
> Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0
>
> Attached is the stripped up minimal example that demonstrates the issue with cxf-codegen-plugin.
>
> When running mvn clean generate-sources with 4.0.0 it fails with “Two declarations cause a collision in the ObjectFactory class.”
>
> When changing cxf.version to 3.5.5 it builds successfully.
>
> Best regards,
> Marko
>
>
> From: Marko Kocic
> Sent: Mittwoch, 8. Februar 2023 16:02
> To: 'users@cxf.apache.org'
> <us...@cxf.apache.org>>
> Subject: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0
>
> I already reported the same before subscribing to the mailing list, and now after, hope it won’t result in duplicate posts.
>
> Hi everyone,
>
> I am using cxf for a few years, always keeping it up to date, and now in the process of migrating to 4.0.0 and jakarta packages.
> I got stuck with what I think is the regression in cxf-codegen-plugin.
>
> I have a wsdl file that contain multiple elements which name differs only in underscore, e.g:
>
> <xsd:element name="MIN_LOT_SIZE" type="tns:quantum13.3" />
> <xsd:element name="MINLOTSIZE" type="tns:quantum13.3" />
>
> To avoid clashes, in previous cxf-codegen-plugin versions we added a bindings.xml file like this:
>
> <jaxb:bindings xmlns:jaxb="https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxb%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-7dff89490c5c83137865a58ff38d0a62e9f1b65b<https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxb%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-63fecf9136281c81ad809e3ad8e4accd20970f6f> xmlns:jaxws="https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxws%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-e9b875d9cc64d56045da234d512a52cd651ad447<https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxws%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-db491a2665fff8185546ed0df539c36cae27bfd7> xmlns:xs="https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-460a05c2d7affe67ce714cacd15f69412911b9bb<https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-c2e12848451ac0a6d893f72d096ab0c1a9a9decf> version="1.0">
>   <jaxb:bindings>
>     <jaxb:globalBindings
>       underscoreBinding="asCharInWord" />
>     </jaxb:bindings>
>   <jaxws:bindings node="wsdl:definitions" xmlns:wsdl="https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=http%3a%2f%2fschemas.xmlsoap.org%2fwsdl%2f%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-a63962b219b7cfe632da28cde132182c3933e09b<https://ddec1-0-en-ctp.trendmicro.com/wis/clicktime/v1/query?url=http%3a%2f%2fschemas.xmlsoap.org%2fwsdl%2f%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-6daad4b0e6e3cbdf3a6ddcbe3cb2a7e791b030bd>>
>     <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
>   </jaxws:bindings>
> </jaxb:bindings>
>
> And added it like this to cxf-codegen-plugin invocation:
> <plugin>
>   <groupId>org.apache.cxf</groupId>
>   <artifactId>cxf-codegen-plugin</artifactId>
>   <executions>
>     <execution>
>       <id>generate-sources</id>
>       <phase>generate-sources</phase>
>       <configuration>
>         <args>
>           <arg>-B-XautoNameResolution</arg>
>         </args>
>         <sourceRoot>${basedir}/target/generated/cxf</sourceRoot>
>         <wsdlOptions>
>           <wsdlOption>
>             <wsdl>${basedir}/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdl>
>             <wsdlLocation>classpath:wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdlLocation>
>             <packagenames>
>               <packagename>urn:sap-com:document:sap:rfc:functions=com.project.s4.getMaterialAll
>             </packagename>
>           </packagenames>
>           <bindingFiles>
>             <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
>           </bindingFiles>
>         </wsdlOption>
>       </wsdlOptions>
>       <goals>
>         <goal>wsdl2java</goal>
>       </goals>
>     </execution>
>     </executions>
> </plugin>
>
> This approach worked fine until we upgraded to the latest cxf-codegen-plugin version 4.0.0. Now I get the following warnings and an error when running the goal:
>
> [INFO] --- cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) @ TSS.IA.S4.Library --- [INFO] Running code generation in fork mode...
> [INFO] The java executable is C:\opt\jdk\bin\java.exe [INFO] Building
> jar:
> C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537
> 481386814\cxf-codegen3605968430553657029.jar
> [INFO] 11:42:22.873 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
> [INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Starting Apache
> Velocity v2.3 [INFO] 11:42:22.888 [main] DEBUG org.apache.velocity -
> Default Properties resource:
> org/apache/velocity/runtime/defaults/velocity.properties
> [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(ToolE
> rrorListener.java:87) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCont
> ainer.java:158) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCont
> ainer.java:402) [WARNING] at
> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.jav
> a: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(ForkOnceW
> SDL2Java.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(O
> bjectFactoryGeneratorImpl.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.ja
> va: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(SchemaCompilerI
> mpl.java:255) [WARNING] at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerI
> mpl.java:67) [WARNING] at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initializ
> e(JAXBDataBinding.java:445) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJa
> vaContainer.java:711) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJava
> Container.java:259) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCont
> ainer.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
> [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: 919; columnNumber: 16; (Related to above error) This is the other declaration.
> [WARNING] at
> com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(O
> bjectFactoryGeneratorImpl.java:163)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate
> (PublicObjectFactoryGenerator.java:29)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.ja
> va: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(SchemaCompilerI
> mpl.java:255) [WARNING] at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerI
> mpl.java:67) [WARNING] at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initializ
> e(JAXBDataBinding.java:445) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJa
> vaContainer.java:711) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJava
> Container.java:259) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCont
> ainer.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 [878,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: 878; 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(O
> bjectFactoryGeneratorImpl.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.ja
> va: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(SchemaCompilerI
> mpl.java:255) [WARNING] at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerI
> mpl.java:67) [WARNING] at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initializ
> e(JAXBDataBinding.java:445) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJa
> vaContainer.java:711) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJava
> Container.java:259) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCont
> ainer.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 [1006,16]: (Related to above error) This is the other declaration.
> [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: 1006; columnNumber: 16; (Related to above error) This is the other declaration.
> [WARNING] at
> com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(O
> bjectFactoryGeneratorImpl.java:163)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate
> (PublicObjectFactoryGenerator.java:29)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.ja
> va: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(SchemaCompilerI
> mpl.java:255) [WARNING] at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerI
> mpl.java:67) [WARNING] at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initializ
> e(JAXBDataBinding.java:445) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJa
> vaContainer.java:711) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJava
> Container.java:259) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCont
> ainer.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 [879,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: 879; 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(O
> bjectFactoryGeneratorImpl.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.ja
> va: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(SchemaCompilerI
> mpl.java:255) [WARNING] at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerI
> mpl.java:67) [WARNING] at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initializ
> e(JAXBDataBinding.java:445) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJa
> vaContainer.java:711) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJava
> Container.java:259) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCont
> ainer.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 [1007,16]: (Related to above error) This is the other declaration.
> [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: 1007; columnNumber: 16; (Related to above error) This is the other declaration.
> [WARNING] at
> com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(O
> bjectFactoryGeneratorImpl.java:163)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate
> (PublicObjectFactoryGenerator.java:29)
> [WARNING] at
> com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.ja
> va: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(SchemaCompilerI
> mpl.java:255) [WARNING] at
> com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerI
> mpl.java:67) [WARNING] at
> org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initializ
> e(JAXBDataBinding.java:445) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJa
> vaContainer.java:711) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJava
> Container.java:259) [WARNING] at
> org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCont
> ainer.java:156)
> [WARNING] ... 5 more
>
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] BUILD FAILURE
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] Total time: 5.826 s
> [INFO] Finished at: 2023-02-08T11:42:24+01:00 [INFO]
> ----------------------------------------------------------------------
> -- [ERROR] Failed to execute goal
> org.apache.cxf:cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) on project TSS.IA.S4.Library:
> [ERROR] Exit code: 1
> [ERROR] Command line was: cmd.exe /X /C "C:\opt\jdk\bin\java.exe --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -Dorg.apache.cxf.Logger=null -jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-w2j11803512441830701137args"
>
> Does anyone eles has the same issue with the latest cxf-codegen-plugin wsdl2java task, or I missed something during the upgrade?
>
> Returning back to the old cxf-codegen-plugin is not an option, since it generates code in javax instead of Jakarta packages.
>
> Best regards,
> Marko
>
>
>

Re: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Posted by Colm O hEigeartaigh <co...@apache.org>.
Hi Marko,

Did you request to create an account in JIRA so that you can create
the ticket? https://selfserve.apache.org/jira-account.html

Colm.

On Tue, Apr 18, 2023 at 3:19 PM Marko Kocic <Ma...@trelleborg.com> wrote:
>
> Hi everyone,
>
> I can't find this issue reported in CXF Jira. Since it's not public, can someone with the access to bug tracker report this as a regression bug in cxf-codegen-plugin 4.0.0 ?
>
> Cheers,
> Marko
>
> -----Original Message-----
> From: Marko Kocic <Ma...@trelleborg.com>
> Sent: Montag, 13. Februar 2023 12:22
> To: users@cxf.apache.org
> Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0
>
> Hi,
>
> The attachment in previous mail is just a stripped down minimal example that ilustrates the issue with the new cxf-codegen plugin 4.0.0.
>
> The real wsdl file is huge and changes relatively frequently, and we have many such files in a project, so it's not feasible to edit them manually every time.
>
> The old cxf-codegen-plugin 3.5.5 and earlier didn't have issue with duplicate names, they would generate properties like this by default:
>
>     @XmlElement(name = "LOGNO", required = true)
>     protected String logno;
>     @XmlElement(name = "LOG_NO", required = true)
>     protected String log_NO;
>
> It's the new cxf-codegen-plugin 4.0.0 that fails with errors about duplicate names. Something got broken in this release in this regard.
> If you look at the attached project, we even tried providing bindings configuration which should explicitly force proper handling of underscore character, but it looks like it get's ignored: underscoreBinding="asCharInWord"
>
> If the old cxf-codegen-plugin were able to generate java code using Jakarta namespace, we could still use it, but since we want to switch to the cxf-4.0.0, that uses Jakarta namespaces, we had to use cxf-codegen-plugin 4.0.0 which is broken in this regard.
>
> Cheers,
> Marko
>
> -----Original Message-----
> From: Lulseged Zerfu <zl...@hotmail.com>
> Sent: Samstag, 11. Februar 2023 11:22
> To: users@cxf.apache.org
> Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0
>
> Hi
>
> You need to customize because these 2 elements will get same class name:
>
> <xsd:element name="LOGNO" type="tns:char20"/> <xsd:element name="LOG_NO" type="tns:char20"/>
>
> May be you can instead put like:
>
> <xsd:element name="LOGNO" type="tns:char20" maxOccurs="2"/>
>
> BR
> Lulseged
>
> From: Marko Kocic <Ma...@trelleborg.com>
> Sent: Thursday, 9 February 2023 16:24
> To: users@cxf.apache.org
> Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0
>
> Attached is the stripped up minimal example that demonstrates the issue with cxf-codegen-plugin.
>
> When running mvn clean generate-sources with 4.0.0 it fails with “Two declarations cause a collision in the ObjectFactory class.”
>
> When changing cxf.version to 3.5.5 it builds successfully.
>
> Best regards,
> Marko
>
>
> From: Marko Kocic
> Sent: Mittwoch, 8. Februar 2023 16:02
> To: 'users@cxf.apache.org' <us...@cxf.apache.org>>
> Subject: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0
>
> I already reported the same before subscribing to the mailing list, and now after, hope it won’t result in duplicate posts.
>
> Hi everyone,
>
> I am using cxf for a few years, always keeping it up to date, and now in the process of migrating to 4.0.0 and jakarta packages.
> I got stuck with what I think is the regression in cxf-codegen-plugin.
>
> I have a wsdl file that contain multiple elements which name differs only in underscore, e.g:
>
> <xsd:element name="MIN_LOT_SIZE" type="tns:quantum13.3" /> <xsd:element name="MINLOTSIZE" type="tns:quantum13.3" />
>
> To avoid clashes, in previous cxf-codegen-plugin versions we added a bindings.xml file like this:
>
> <jaxb:bindings xmlns:jaxb="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxb%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-7dff89490c5c83137865a58ff38d0a62e9f1b65b<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxb%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-63fecf9136281c81ad809e3ad8e4accd20970f6f> xmlns:jaxws="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxws%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-e9b875d9cc64d56045da234d512a52cd651ad447<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxws%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-db491a2665fff8185546ed0df539c36cae27bfd7> xmlns:xs="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-460a05c2d7affe67ce714cacd15f69412911b9bb<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-c2e12848451ac0a6d893f72d096ab0c1a9a9decf> version="1.0">
>   <jaxb:bindings>
>     <jaxb:globalBindings
>       underscoreBinding="asCharInWord" />
>     </jaxb:bindings>
>   <jaxws:bindings node="wsdl:definitions" xmlns:wsdl="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fschemas.xmlsoap.org%2fwsdl%2f%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-a63962b219b7cfe632da28cde132182c3933e09b<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fschemas.xmlsoap.org%2fwsdl%2f%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-6daad4b0e6e3cbdf3a6ddcbe3cb2a7e791b030bd>>
>     <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
>   </jaxws:bindings>
> </jaxb:bindings>
>
> And added it like this to cxf-codegen-plugin invocation:
> <plugin>
>   <groupId>org.apache.cxf</groupId>
>   <artifactId>cxf-codegen-plugin</artifactId>
>   <executions>
>     <execution>
>       <id>generate-sources</id>
>       <phase>generate-sources</phase>
>       <configuration>
>         <args>
>           <arg>-B-XautoNameResolution</arg>
>         </args>
>         <sourceRoot>${basedir}/target/generated/cxf</sourceRoot>
>         <wsdlOptions>
>           <wsdlOption>
>             <wsdl>${basedir}/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdl>
>             <wsdlLocation>classpath:wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdlLocation>
>             <packagenames>
>               <packagename>urn:sap-com:document:sap:rfc:functions=com.project.s4.getMaterialAll
>             </packagename>
>           </packagenames>
>           <bindingFiles>
>             <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
>           </bindingFiles>
>         </wsdlOption>
>       </wsdlOptions>
>       <goals>
>         <goal>wsdl2java</goal>
>       </goals>
>     </execution>
>     </executions>
> </plugin>
>
> This approach worked fine until we upgraded to the latest cxf-codegen-plugin version 4.0.0. Now I get the following warnings and an error when running the goal:
>
> [INFO] --- cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) @ TSS.IA.S4.Library --- [INFO] Running code generation in fork mode...
> [INFO] The java executable is C:\opt\jdk\bin\java.exe [INFO] Building jar: C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar
> [INFO] 11:42:22.873 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
> [INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.3 [INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties
> [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
> [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: 919; columnNumber: 16; (Related to above error) This is the other declaration.
> [WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
> [WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
> [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 [878,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: 878; 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 [1006,16]: (Related to above error) This is the other declaration.
> [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: 1006; columnNumber: 16; (Related to above error) This is the other declaration.
> [WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
> [WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
> [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 [879,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: 879; 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 [1007,16]: (Related to above error) This is the other declaration.
> [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: 1007; columnNumber: 16; (Related to above error) This is the other declaration.
> [WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
> [WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
> [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
>
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 5.826 s
> [INFO] Finished at: 2023-02-08T11:42:24+01:00 [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) on project TSS.IA.S4.Library:
> [ERROR] Exit code: 1
> [ERROR] Command line was: cmd.exe /X /C "C:\opt\jdk\bin\java.exe --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -Dorg.apache.cxf.Logger=null -jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-w2j11803512441830701137args"
>
> Does anyone eles has the same issue with the latest cxf-codegen-plugin wsdl2java task, or I missed something during the upgrade?
>
> Returning back to the old cxf-codegen-plugin is not an option, since it generates code in javax instead of Jakarta packages.
>
> Best regards,
> Marko
>
>
>

RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Posted by Marko Kocic <Ma...@trelleborg.com>.
Hi everyone,

I can't find this issue reported in CXF Jira. Since it's not public, can someone with the access to bug tracker report this as a regression bug in cxf-codegen-plugin 4.0.0 ?

Cheers,
Marko

-----Original Message-----
From: Marko Kocic <Ma...@trelleborg.com> 
Sent: Montag, 13. Februar 2023 12:22
To: users@cxf.apache.org
Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Hi,

The attachment in previous mail is just a stripped down minimal example that ilustrates the issue with the new cxf-codegen plugin 4.0.0.

The real wsdl file is huge and changes relatively frequently, and we have many such files in a project, so it's not feasible to edit them manually every time.

The old cxf-codegen-plugin 3.5.5 and earlier didn't have issue with duplicate names, they would generate properties like this by default:

    @XmlElement(name = "LOGNO", required = true)
    protected String logno;
    @XmlElement(name = "LOG_NO", required = true)
    protected String log_NO;

It's the new cxf-codegen-plugin 4.0.0 that fails with errors about duplicate names. Something got broken in this release in this regard.
If you look at the attached project, we even tried providing bindings configuration which should explicitly force proper handling of underscore character, but it looks like it get's ignored: underscoreBinding="asCharInWord"

If the old cxf-codegen-plugin were able to generate java code using Jakarta namespace, we could still use it, but since we want to switch to the cxf-4.0.0, that uses Jakarta namespaces, we had to use cxf-codegen-plugin 4.0.0 which is broken in this regard.

Cheers,
Marko

-----Original Message-----
From: Lulseged Zerfu <zl...@hotmail.com> 
Sent: Samstag, 11. Februar 2023 11:22
To: users@cxf.apache.org
Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Hi

You need to customize because these 2 elements will get same class name:

<xsd:element name="LOGNO" type="tns:char20"/> <xsd:element name="LOG_NO" type="tns:char20"/>

May be you can instead put like:

<xsd:element name="LOGNO" type="tns:char20" maxOccurs="2"/>

BR
Lulseged

From: Marko Kocic <Ma...@trelleborg.com>
Sent: Thursday, 9 February 2023 16:24
To: users@cxf.apache.org
Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Attached is the stripped up minimal example that demonstrates the issue with cxf-codegen-plugin.

When running mvn clean generate-sources with 4.0.0 it fails with “Two declarations cause a collision in the ObjectFactory class.”

When changing cxf.version to 3.5.5 it builds successfully.

Best regards,
Marko


From: Marko Kocic
Sent: Mittwoch, 8. Februar 2023 16:02
To: 'users@cxf.apache.org' <us...@cxf.apache.org>>
Subject: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

I already reported the same before subscribing to the mailing list, and now after, hope it won’t result in duplicate posts.

Hi everyone,

I am using cxf for a few years, always keeping it up to date, and now in the process of migrating to 4.0.0 and jakarta packages.
I got stuck with what I think is the regression in cxf-codegen-plugin.

I have a wsdl file that contain multiple elements which name differs only in underscore, e.g:

<xsd:element name="MIN_LOT_SIZE" type="tns:quantum13.3" /> <xsd:element name="MINLOTSIZE" type="tns:quantum13.3" />

To avoid clashes, in previous cxf-codegen-plugin versions we added a bindings.xml file like this:

<jaxb:bindings xmlns:jaxb="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxb%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-7dff89490c5c83137865a58ff38d0a62e9f1b65b<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxb%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-63fecf9136281c81ad809e3ad8e4accd20970f6f> xmlns:jaxws="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxws%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-e9b875d9cc64d56045da234d512a52cd651ad447<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxws%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-db491a2665fff8185546ed0df539c36cae27bfd7> xmlns:xs="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-460a05c2d7affe67ce714cacd15f69412911b9bb<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-c2e12848451ac0a6d893f72d096ab0c1a9a9decf> version="1.0">
  <jaxb:bindings>
    <jaxb:globalBindings
      underscoreBinding="asCharInWord" />
    </jaxb:bindings>
  <jaxws:bindings node="wsdl:definitions" xmlns:wsdl="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fschemas.xmlsoap.org%2fwsdl%2f%22&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-a63962b219b7cfe632da28cde132182c3933e09b<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fschemas.xmlsoap.org%2fwsdl%2f%2522&umid=1c2c2d2f-2c77-4ec3-a45e-528bf638b501&auth=b6670b9751c5c90ededae23711566d84a7ddb070-6daad4b0e6e3cbdf3a6ddcbe3cb2a7e791b030bd>>
    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
  </jaxws:bindings>
</jaxb:bindings>

And added it like this to cxf-codegen-plugin invocation:
<plugin>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-codegen-plugin</artifactId>
  <executions>
    <execution>
      <id>generate-sources</id>
      <phase>generate-sources</phase>
      <configuration>
        <args>
          <arg>-B-XautoNameResolution</arg>
        </args>
        <sourceRoot>${basedir}/target/generated/cxf</sourceRoot>
        <wsdlOptions>
          <wsdlOption>
            <wsdl>${basedir}/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdl>
            <wsdlLocation>classpath:wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdlLocation>
            <packagenames>
              <packagename>urn:sap-com:document:sap:rfc:functions=com.project.s4.getMaterialAll
            </packagename>
          </packagenames>
          <bindingFiles>
            <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
          </bindingFiles>
        </wsdlOption>
      </wsdlOptions>
      <goals>
        <goal>wsdl2java</goal>
      </goals>
    </execution>
    </executions>
</plugin>

This approach worked fine until we upgraded to the latest cxf-codegen-plugin version 4.0.0. Now I get the following warnings and an error when running the goal:

[INFO] --- cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) @ TSS.IA.S4.Library --- [INFO] Running code generation in fork mode...
[INFO] The java executable is C:\opt\jdk\bin\java.exe [INFO] Building jar: C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar
[INFO] 11:42:22.873 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
[INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.3 [INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties
[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
[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: 919; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [878,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: 878; 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 [1006,16]: (Related to above error) This is the other declaration.
[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: 1006; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [879,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: 879; 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 [1007,16]: (Related to above error) This is the other declaration.
[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: 1007; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.826 s
[INFO] Finished at: 2023-02-08T11:42:24+01:00 [INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) on project TSS.IA.S4.Library:
[ERROR] Exit code: 1
[ERROR] Command line was: cmd.exe /X /C "C:\opt\jdk\bin\java.exe --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -Dorg.apache.cxf.Logger=null -jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-w2j11803512441830701137args"

Does anyone eles has the same issue with the latest cxf-codegen-plugin wsdl2java task, or I missed something during the upgrade?

Returning back to the old cxf-codegen-plugin is not an option, since it generates code in javax instead of Jakarta packages.

Best regards,
Marko




RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Posted by Marko Kocic <Ma...@trelleborg.com>.
Hi,

The attachment in previous mail is just a stripped down minimal example that ilustrates the issue with the new cxf-codegen plugin 4.0.0.

The real wsdl file is huge and changes relatively frequently, and we have many such files in a project, so it's not feasible to edit them manually every time.

The old cxf-codegen-plugin 3.5.5 and earlier didn't have issue with duplicate names, they would generate properties like this by default:

    @XmlElement(name = "LOGNO", required = true)
    protected String logno;
    @XmlElement(name = "LOG_NO", required = true)
    protected String log_NO;

It's the new cxf-codegen-plugin 4.0.0 that fails with errors about duplicate names. Something got broken in this release in this regard.
If you look at the attached project, we even tried providing bindings configuration which should explicitly force proper handling of underscore character, but it looks like it get's ignored: underscoreBinding="asCharInWord"

If the old cxf-codegen-plugin were able to generate java code using Jakarta namespace, we could still use it, but since we want to switch to the cxf-4.0.0, that uses Jakarta namespaces, we had to use cxf-codegen-plugin 4.0.0 which is broken in this regard.

Cheers,
Marko

-----Original Message-----
From: Lulseged Zerfu <zl...@hotmail.com> 
Sent: Samstag, 11. Februar 2023 11:22
To: users@cxf.apache.org
Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Hi

You need to customize because these 2 elements will get same class name:

<xsd:element name="LOGNO" type="tns:char20"/> <xsd:element name="LOG_NO" type="tns:char20"/>

May be you can instead put like:

<xsd:element name="LOGNO" type="tns:char20" maxOccurs="2"/>

BR
Lulseged

From: Marko Kocic <Ma...@trelleborg.com>
Sent: Thursday, 9 February 2023 16:24
To: users@cxf.apache.org
Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Attached is the stripped up minimal example that demonstrates the issue with cxf-codegen-plugin.

When running mvn clean generate-sources with 4.0.0 it fails with “Two declarations cause a collision in the ObjectFactory class.”

When changing cxf.version to 3.5.5 it builds successfully.

Best regards,
Marko


From: Marko Kocic
Sent: Mittwoch, 8. Februar 2023 16:02
To: 'users@cxf.apache.org' <us...@cxf.apache.org>>
Subject: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

I already reported the same before subscribing to the mailing list, and now after, hope it won’t result in duplicate posts.

Hi everyone,

I am using cxf for a few years, always keeping it up to date, and now in the process of migrating to 4.0.0 and jakarta packages.
I got stuck with what I think is the regression in cxf-codegen-plugin.

I have a wsdl file that contain multiple elements which name differs only in underscore, e.g:

<xsd:element name="MIN_LOT_SIZE" type="tns:quantum13.3" /> <xsd:element name="MINLOTSIZE" type="tns:quantum13.3" />

To avoid clashes, in previous cxf-codegen-plugin versions we added a bindings.xml file like this:

<jaxb:bindings xmlns:jaxb="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxb%22&umid=d1ee91eb-e4de-41a5-bde7-50479c2bf79f&auth=b6670b9751c5c90ededae23711566d84a7ddb070-1d787fcc9bf02419b5420749592661b7a9b3e504<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxb%2522&umid=d1ee91eb-e4de-41a5-bde7-50479c2bf79f&auth=b6670b9751c5c90ededae23711566d84a7ddb070-3c36f0ae4de20267333159293763f6ec84d507f1> xmlns:jaxws="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxws%22&umid=d1ee91eb-e4de-41a5-bde7-50479c2bf79f&auth=b6670b9751c5c90ededae23711566d84a7ddb070-1a392ae9a3638561ca6775853fcbb91170c01a8f<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fjava.sun.com%2fxml%2fns%2fjaxws%2522&umid=d1ee91eb-e4de-41a5-bde7-50479c2bf79f&auth=b6670b9751c5c90ededae23711566d84a7ddb070-b7941c45252a3521b2d0a6556068bdfa8080bef3> xmlns:xs="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%22&umid=d1ee91eb-e4de-41a5-bde7-50479c2bf79f&auth=b6670b9751c5c90ededae23711566d84a7ddb070-9ce9bf4e6bd3167a41e186f47a7be7ed73a6c2e7<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.w3.org%2f2001%2fXMLSchema%2522&umid=d1ee91eb-e4de-41a5-bde7-50479c2bf79f&auth=b6670b9751c5c90ededae23711566d84a7ddb070-4758fb592881b690205e1fbd1f606cf6c5b8dc72> version="1.0">
  <jaxb:bindings>
    <jaxb:globalBindings
      underscoreBinding="asCharInWord" />
    </jaxb:bindings>
  <jaxws:bindings node="wsdl:definitions" xmlns:wsdl="https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fschemas.xmlsoap.org%2fwsdl%2f%22&umid=d1ee91eb-e4de-41a5-bde7-50479c2bf79f&auth=b6670b9751c5c90ededae23711566d84a7ddb070-72d63fd0b5ec005d37d1959a800f44c29451f49a<https://ddec1-0-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fschemas.xmlsoap.org%2fwsdl%2f%2522&umid=d1ee91eb-e4de-41a5-bde7-50479c2bf79f&auth=b6670b9751c5c90ededae23711566d84a7ddb070-1880950c0393251ffbe26f2032e10f9e8b65bdff>>
    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
  </jaxws:bindings>
</jaxb:bindings>

And added it like this to cxf-codegen-plugin invocation:
<plugin>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-codegen-plugin</artifactId>
  <executions>
    <execution>
      <id>generate-sources</id>
      <phase>generate-sources</phase>
      <configuration>
        <args>
          <arg>-B-XautoNameResolution</arg>
        </args>
        <sourceRoot>${basedir}/target/generated/cxf</sourceRoot>
        <wsdlOptions>
          <wsdlOption>
            <wsdl>${basedir}/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdl>
            <wsdlLocation>classpath:wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdlLocation>
            <packagenames>
              <packagename>urn:sap-com:document:sap:rfc:functions=com.project.s4.getMaterialAll
            </packagename>
          </packagenames>
          <bindingFiles>
            <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
          </bindingFiles>
        </wsdlOption>
      </wsdlOptions>
      <goals>
        <goal>wsdl2java</goal>
      </goals>
    </execution>
    </executions>
</plugin>

This approach worked fine until we upgraded to the latest cxf-codegen-plugin version 4.0.0. Now I get the following warnings and an error when running the goal:

[INFO] --- cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) @ TSS.IA.S4.Library --- [INFO] Running code generation in fork mode...
[INFO] The java executable is C:\opt\jdk\bin\java.exe [INFO] Building jar: C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar
[INFO] 11:42:22.873 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
[INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.3 [INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties
[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
[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: 919; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [878,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: 878; 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 [1006,16]: (Related to above error) This is the other declaration.
[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: 1006; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [879,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: 879; 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 [1007,16]: (Related to above error) This is the other declaration.
[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: 1007; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.826 s
[INFO] Finished at: 2023-02-08T11:42:24+01:00 [INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) on project TSS.IA.S4.Library:
[ERROR] Exit code: 1
[ERROR] Command line was: cmd.exe /X /C "C:\opt\jdk\bin\java.exe --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -Dorg.apache.cxf.Logger=null -jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-w2j11803512441830701137args"

Does anyone eles has the same issue with the latest cxf-codegen-plugin wsdl2java task, or I missed something during the upgrade?

Returning back to the old cxf-codegen-plugin is not an option, since it generates code in javax instead of Jakarta packages.

Best regards,
Marko




RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Posted by Lulseged Zerfu <zl...@hotmail.com>.
Hi

You need to customize because these 2 elements will get same class name:

<xsd:element name="LOGNO" type="tns:char20"/>
<xsd:element name="LOG_NO" type="tns:char20"/>

May be you can instead put like:

<xsd:element name="LOGNO" type="tns:char20" maxOccurs="2"/>

BR
Lulseged

From: Marko Kocic <Ma...@trelleborg.com>
Sent: Thursday, 9 February 2023 16:24
To: users@cxf.apache.org
Subject: RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Attached is the stripped up minimal example that demonstrates the issue with cxf-codegen-plugin.

When running mvn clean generate-sources with 4.0.0 it fails with “Two declarations cause a collision in the ObjectFactory class.”

When changing cxf.version to 3.5.5 it builds successfully.

Best regards,
Marko


From: Marko Kocic
Sent: Mittwoch, 8. Februar 2023 16:02
To: 'users@cxf.apache.org' <us...@cxf.apache.org>>
Subject: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

I already reported the same before subscribing to the mailing list, and now after, hope it won’t result in duplicate posts.

Hi everyone,

I am using cxf for a few years, always keeping it up to date, and now in the process of migrating to 4.0.0 and jakarta packages.
I got stuck with what I think is the regression in cxf-codegen-plugin.

I have a wsdl file that contain multiple elements which name differs only in underscore, e.g:

<xsd:element name="MIN_LOT_SIZE" type="tns:quantum13.3" />
<xsd:element name="MINLOTSIZE" type="tns:quantum13.3" />

To avoid clashes, in previous cxf-codegen-plugin versions we added a bindings.xml file like this:

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"<http://java.sun.com/xml/ns/jaxb%22> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"<http://java.sun.com/xml/ns/jaxws%22> xmlns:xs="http://www.w3.org/2001/XMLSchema"<http://www.w3.org/2001/XMLSchema%22> version="1.0">
  <jaxb:bindings>
    <jaxb:globalBindings
      underscoreBinding="asCharInWord" />
    </jaxb:bindings>
  <jaxws:bindings node="wsdl:definitions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"<http://schemas.xmlsoap.org/wsdl/%22>>
    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
  </jaxws:bindings>
</jaxb:bindings>

And added it like this to cxf-codegen-plugin invocation:
<plugin>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-codegen-plugin</artifactId>
  <executions>
    <execution>
      <id>generate-sources</id>
      <phase>generate-sources</phase>
      <configuration>
        <args>
          <arg>-B-XautoNameResolution</arg>
        </args>
        <sourceRoot>${basedir}/target/generated/cxf</sourceRoot>
        <wsdlOptions>
          <wsdlOption>
            <wsdl>${basedir}/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdl>
            <wsdlLocation>classpath:wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdlLocation>
            <packagenames>
              <packagename>urn:sap-com:document:sap:rfc:functions=com.project.s4.getMaterialAll
            </packagename>
          </packagenames>
          <bindingFiles>
            <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
          </bindingFiles>
        </wsdlOption>
      </wsdlOptions>
      <goals>
        <goal>wsdl2java</goal>
      </goals>
    </execution>
    </executions>
</plugin>

This approach worked fine until we upgraded to the latest cxf-codegen-plugin version 4.0.0. Now I get the following warnings and an error when running the goal:

[INFO] --- cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) @ TSS.IA.S4.Library ---
[INFO] Running code generation in fork mode...
[INFO] The java executable is C:\opt\jdk\bin\java.exe
[INFO] Building jar: C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar
[INFO] 11:42:22.873 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
[INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.3
[INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties
[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
[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: 919; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [878,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: 878; 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 [1006,16]: (Related to above error) This is the other declaration.
[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: 1006; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [879,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: 879; 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 [1007,16]: (Related to above error) This is the other declaration.
[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: 1007; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.826 s
[INFO] Finished at: 2023-02-08T11:42:24+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) on project TSS.IA.S4.Library:
[ERROR] Exit code: 1
[ERROR] Command line was: cmd.exe /X /C "C:\opt\jdk\bin\java.exe --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -Dorg.apache.cxf.Logger=null -jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-w2j11803512441830701137args"

Does anyone eles has the same issue with the latest cxf-codegen-plugin wsdl2java task, or I missed something during the upgrade?

Returning back to the old cxf-codegen-plugin is not an option, since it generates code in javax instead of Jakarta packages.

Best regards,
Marko




RE: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

Posted by Marko Kocic <Ma...@trelleborg.com>.
Attached is the stripped up minimal example that demonstrates the issue with cxf-codegen-plugin.

When running mvn clean generate-sources with 4.0.0 it fails with "Two declarations cause a collision in the ObjectFactory class."

When changing cxf.version to 3.5.5 it builds successfully.

Best regards,
Marko


From: Marko Kocic
Sent: Mittwoch, 8. Februar 2023 16:02
To: 'users@cxf.apache.org' <us...@cxf.apache.org>
Subject: Possible regression in cxf-codegen-plugin wsdl2java 4.0.0

I already reported the same before subscribing to the mailing list, and now after, hope it won't result in duplicate posts.

Hi everyone,

I am using cxf for a few years, always keeping it up to date, and now in the process of migrating to 4.0.0 and jakarta packages.
I got stuck with what I think is the regression in cxf-codegen-plugin.

I have a wsdl file that contain multiple elements which name differs only in underscore, e.g:

<xsd:element name="MIN_LOT_SIZE" type="tns:quantum13.3" />
<xsd:element name="MINLOTSIZE" type="tns:quantum13.3" />

To avoid clashes, in previous cxf-codegen-plugin versions we added a bindings.xml file like this:

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"<http://java.sun.com/xml/ns/jaxb%22> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"<http://java.sun.com/xml/ns/jaxws%22> xmlns:xs="http://www.w3.org/2001/XMLSchema"<http://www.w3.org/2001/XMLSchema%22> version="1.0">
  <jaxb:bindings>
    <jaxb:globalBindings
      underscoreBinding="asCharInWord" />
    </jaxb:bindings>
  <jaxws:bindings node="wsdl:definitions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"<http://schemas.xmlsoap.org/wsdl/%22>>
    <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
  </jaxws:bindings>
</jaxb:bindings>

And added it like this to cxf-codegen-plugin invocation:
<plugin>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-codegen-plugin</artifactId>
  <executions>
    <execution>
      <id>generate-sources</id>
      <phase>generate-sources</phase>
      <configuration>
        <args>
          <arg>-B-XautoNameResolution</arg>
        </args>
        <sourceRoot>${basedir}/target/generated/cxf</sourceRoot>
        <wsdlOptions>
          <wsdlOption>
            <wsdl>${basedir}/src/main/resources/wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdl>
            <wsdlLocation>classpath:wsdl/Z_BAPI_MATERIAL_GET_ALL.wsdl</wsdlLocation>
            <packagenames>
              <packagename>urn:sap-com:document:sap:rfc:functions=com.project.s4.getMaterialAll
            </packagename>
          </packagenames>
          <bindingFiles>
            <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
          </bindingFiles>
        </wsdlOption>
      </wsdlOptions>
      <goals>
        <goal>wsdl2java</goal>
      </goals>
    </execution>
    </executions>
</plugin>

This approach worked fine until we upgraded to the latest cxf-codegen-plugin version 4.0.0. Now I get the following warnings and an error when running the goal:

[INFO] --- cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) @ TSS.IA.S4.Library ---
[INFO] Running code generation in fork mode...
[INFO] The java executable is C:\opt\jdk\bin\java.exe
[INFO] Building jar: C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar
[INFO] 11:42:22.873 [main] DEBUG org.apache.velocity - Initializing Velocity, Calling init()...
[INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Starting Apache Velocity v2.3
[INFO] 11:42:22.888 [main] DEBUG org.apache.velocity - Default Properties resource: org/apache/velocity/runtime/defaults/velocity.properties
[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
[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: 919; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [878,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: 878; 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 [1006,16]: (Related to above error) This is the other declaration.
[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: 1006; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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 [879,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: 879; 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 [1007,16]: (Related to above error) This is the other declaration.
[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: 1007; columnNumber: 16; (Related to above error) This is the other declaration.
[WARNING] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:56)
[WARNING] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:163)
[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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.826 s
[INFO] Finished at: 2023-02-08T11:42:24+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:4.0.0:wsdl2java (generate-sources) on project TSS.IA.S4.Library:
[ERROR] Exit code: 1
[ERROR] Command line was: cmd.exe /X /C "C:\opt\jdk\bin\java.exe --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -Dorg.apache.cxf.Logger=null -jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-codegen3605968430553657029.jar C:\Users\Marko.Kocic\scoop\apps\msys2\2023-01-27\tmp\cxf-tmp-792315537481386814\cxf-w2j11803512441830701137args"

Does anyone eles has the same issue with the latest cxf-codegen-plugin wsdl2java task, or I missed something during the upgrade?

Returning back to the old cxf-codegen-plugin is not an option, since it generates code in javax instead of Jakarta packages.

Best regards,
Marko