-->

Spring-Core-WS isn't compatible with Spring 4.

2019-07-30 04:50发布

问题:

I always try to use the latest jars/apis in my Spring project. We had a Spring 4.2.4.RELEASE and then I upgraded to 4.3.0. Everything builds and compiles just fine ... however, when I try to run my unit tests, I was getting an error message. I did trace it down to Spring-WS-Core and Spring-WS-Core-Test 2.3.0 pulls in: Spring-core, web, webmvc, beans 4.0.9.

Has anyone else seen this before? Do I have to go back to Spring 4.2?

Thanks!

回答1:

I downgraded my app to 4.2.7.RELEASE which was the latest before Spring 4.3.0, and this did not help. Ultimately, I had to update my maven dependencies as follows:

    <!-- Spring SOAP Client Dependencies -->
    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
        <version>${spring.ws.core.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-expression</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!-- Spring SOAP Client TEST Dependencies -->
    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-test</artifactId>
        <version>${spring.ws.core.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-expression</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

Why Spring Web-Services (for SOAP web-services) still uses Spring 4.0.9 and has not been updated yet to use Spring 4.2.x or 4.3.0 is beyond me. That seems like an oversight.

The symptoms of this problem is that I was getting ClassDefNotFound errors in various spring.framework packages. I think I have this problem resolved.