Donnerstag, 13. April 2023

Migrate to Spring Boot 3, but stay with jaxws-api 2.3.1

There are good guides (Spring Boot 3.0 Migration Guide) to migrate a Spring Boot 2.7.x project to 3.0.x, but in my case I got some technical debt from jaxws.

The project consumes a lot of different services (soap, rest) where the generated code is capsuled in a little jar. This jars are used by some other projects, so I could not touch them. This means the project has to use jaxws-api 2.3.1.

I got a lot of errors when following the normal migration guides with the jaxb stuff which all could be solved with the proper dependencies.

Dependencies before migration:


     	<dependency>
            <groupid>javax.xml.ws</groupid>
            <artifactid>jaxws-api</artifactid>
        </dependency>
        <dependency>
            <groupid>com.sun.xml.ws</groupid>
            <artifactid>rt</artifactid>
            <version>2.3.2</version>
            <exclusions>
                <!--this is excluded to have fewer log entries on startup-->
                <exclusion>
                    <artifactid>ha-api</artifactid>
                    <groupid>org.glassfish.ha</groupid>
                </exclusion>
            </exclusions>
        </dependency>

After a lot of trail and error I came up with the following solution:

        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <!-- needed for java.lang.ClassNotFoundException: com.sun.xml.bind.api.JAXBRIContext -->
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.messaging.saaj</groupId>
            <artifactId>saaj-impl</artifactId>
            <version>1.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.staxex</groupId>
            <artifactId>stax-ex</artifactId>
            <version>1.8.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>rt</artifactId>
            <version>2.3.1</version>
            <exclusions>
                <!-- this is excluded to have fewer log entries on startup -->
                <exclusion>
                    <artifactId>ha-api</artifactId>
                    <groupId>org.glassfish.ha</groupId>
                </exclusion>
            </exclusions>
        </dependency>


Keine Kommentare:

Kommentar veröffentlichen