Upgrading java 8 to 17, jaxb to jakarta generates source classes from wsdl with javax.xml.bind package and complains about package does not exist

76 views Asked by At

We are in process of upgrading Spring boot 2.7 to 3.2

As part of this upgrade, I upgraded java 8 to java 18 and some other necessary updates too. I updated jaxb schema to jakarta ee and version 3.0.

I changed namespace from java.sun.com to jakarta.ee

Similar changes are made in global-bindings.xml, jaxb-bindings.xml and wsdl-bindings.xml as well

cxf-codegen-plugin is being used for generating source files from wsdl.

<plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf.version}</version>
        <executions>
            <execution>
                <id>generate-sources</id>
                <phase>generate-sources</phase>
                <configuration>
                    <defaultOptions>
                        <bindingFiles>
                            <bindingFile>${project.basedir}/src/main/resources/global-bindings.xjb</bindingFile>
                        </bindingFiles>
                    </defaultOptions>
                    <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
                    <wsdlOptions>
                        <wsdlOption>
                            <wsdl>src/main/resources/OneAPI.wsdl</wsdl>
                            <extraargs>
                                <extraarg>-p</extraarg>
                                <extraarg>http://example.com/One/OneAPI=com.practice.OneAPI</extraarg>
                                <extraarg>-p</extraarg>
                                <extraarg>http://practice.com/OneAPI=com.practice.OneAPI</extraarg>
                            </extraargs>
                        </wsdlOption>
                    </wsdlOptions>
                </configuration>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
            </execution>
        </executions>
</plugin>

Maven build still generates source files in target directory of project with import statement javax.xml.bind.* complains about package does not exist.

I saw many posts similar to this, but none of them resolved my issue.

Am I missing something which I should be taking care as part of upgrade to jakarta?

0

There are 0 answers